Skip to content

Commit 064e5c2

Browse files
committed
ffi methods
1 parent 6d7874e commit 064e5c2

File tree

1 file changed

+55
-0
lines changed
  • crates/processing_ffi/src

1 file changed

+55
-0
lines changed

crates/processing_ffi/src/lib.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,3 +1091,58 @@ pub extern "C" fn processing_geometry_box(width: f32, height: f32, depth: f32) -
10911091
.map(|e| e.to_bits())
10921092
.unwrap_or(0)
10931093
}
1094+
1095+
#[unsafe(no_mangle)]
1096+
pub extern "C" fn processing_light_create_directional(
1097+
graphics_id: u64,
1098+
color: Color,
1099+
illuminance: f32,
1100+
) -> u64 {
1101+
error::clear_error();
1102+
let graphics_entity = Entity::from_bits(graphics_id);
1103+
error::check(|| light_create_directional(graphics_entity, color.into(), illuminance))
1104+
.map(|e| e.to_bits())
1105+
.unwrap_or(0)
1106+
}
1107+
1108+
#[unsafe(no_mangle)]
1109+
pub extern "C" fn processing_light_create_point(
1110+
graphics_id: u64,
1111+
color: Color,
1112+
intensity: f32,
1113+
range: f32,
1114+
radius: f32,
1115+
) -> u64 {
1116+
error::clear_error();
1117+
let graphics_entity = Entity::from_bits(graphics_id);
1118+
error::check(|| light_create_point(graphics_entity, color.into(), intensity, range, radius))
1119+
.map(|e| e.to_bits())
1120+
.unwrap_or(0)
1121+
}
1122+
1123+
#[unsafe(no_mangle)]
1124+
pub extern "C" fn processing_light_create_spot(
1125+
graphics_id: u64,
1126+
color: Color,
1127+
intensity: f32,
1128+
range: f32,
1129+
radius: f32,
1130+
inner_angle: f32,
1131+
outer_angle: f32,
1132+
) -> u64 {
1133+
error::clear_error();
1134+
let graphics_entity = Entity::from_bits(graphics_id);
1135+
error::check(|| {
1136+
light_create_spot(
1137+
graphics_entity,
1138+
color.into(),
1139+
intensity,
1140+
range,
1141+
radius,
1142+
inner_angle,
1143+
outer_angle,
1144+
)
1145+
})
1146+
.map(|e| e.to_bits())
1147+
.unwrap_or(0)
1148+
}

0 commit comments

Comments
 (0)