Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 69 additions & 1 deletion codegen/ffi_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3546,6 +3546,22 @@
"return_type": "bool",
"is_unsafe": false
},
"goud_renderer3d_get_max_bones_per_mesh": {
"source_file": "ffi/renderer3d/environment/config_getters.rs",
"params": [
"context_id: GoudContextId"
],
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_get_max_static_batch_vertices": {
"source_file": "ffi/renderer3d/environment/config_getters.rs",
"params": [
"context_id: GoudContextId"
],
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_get_min_instances_for_batching": {
"source_file": "ffi/renderer3d/environment/config_getters.rs",
"params": [
Expand Down Expand Up @@ -3587,6 +3603,14 @@
"return_type": "u32",
"is_unsafe": false
},
"goud_renderer3d_get_shadow_auto_disable_threshold": {
"source_file": "ffi/renderer3d/environment/config_getters.rs",
"params": [
"context_id: GoudContextId"
],
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_get_shadow_bias": {
"source_file": "ffi/renderer3d/environment/config_getters.rs",
"params": [
Expand All @@ -3603,6 +3627,14 @@
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_get_shadow_strength": {
"source_file": "ffi/renderer3d/environment/config_getters.rs",
"params": [
"context_id: GoudContextId"
],
"return_type": "f32",
"is_unsafe": false
},
"goud_renderer3d_get_shadows_enabled": {
"source_file": "ffi/renderer3d/environment/config_getters.rs",
"params": [
Expand Down Expand Up @@ -3972,6 +4004,24 @@
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_set_max_bones_per_mesh": {
"source_file": "ffi/renderer3d/environment/config_setters.rs",
"params": [
"context_id: GoudContextId",
"bones: u32"
],
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_set_max_static_batch_vertices": {
"source_file": "ffi/renderer3d/environment/config_setters.rs",
"params": [
"context_id: GoudContextId",
"vertices: u32"
],
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_set_min_instances_for_batching": {
"source_file": "ffi/renderer3d/environment/config_setters.rs",
"params": [
Expand Down Expand Up @@ -4105,6 +4155,15 @@
"return_type": "bool",
"is_unsafe": false
},
"goud_renderer3d_set_shadow_auto_disable_threshold": {
"source_file": "ffi/renderer3d/environment/config_setters.rs",
"params": [
"context_id: GoudContextId",
"threshold: u32"
],
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_set_shadow_bias": {
"source_file": "ffi/renderer3d/environment/config_setters.rs",
"params": [
Expand All @@ -4123,6 +4182,15 @@
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_set_shadow_strength": {
"source_file": "ffi/renderer3d/environment/config_setters.rs",
"params": [
"context_id: GoudContextId",
"strength: f32"
],
"return_type": "i32",
"is_unsafe": false
},
"goud_renderer3d_set_shadows_enabled": {
"source_file": "ffi/renderer3d/environment/config_setters.rs",
"params": [
Expand Down Expand Up @@ -6525,5 +6593,5 @@
"is_unsafe": false
}
},
"total_count": 661
"total_count": 669
}
8 changes: 8 additions & 0 deletions codegen/ffi_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,14 @@
"goud_renderer3d_get_shadow_map_size": {},
"goud_renderer3d_set_shadow_bias": {},
"goud_renderer3d_get_shadow_bias": {},
"goud_renderer3d_set_max_static_batch_vertices": {},
"goud_renderer3d_get_max_static_batch_vertices": {},
"goud_renderer3d_set_max_bones_per_mesh": {},
"goud_renderer3d_get_max_bones_per_mesh": {},
"goud_renderer3d_set_shadow_strength": {},
"goud_renderer3d_get_shadow_strength": {},
"goud_renderer3d_set_shadow_auto_disable_threshold": {},
"goud_renderer3d_get_shadow_auto_disable_threshold": {},
"goud_renderer3d_instantiate_model_batch": {},
"goud_renderer3d_set_model_positions_batch": {},
"goud_renderer3d_add_models_to_scene_batch": {},
Expand Down
8 changes: 8 additions & 0 deletions codegen/gen_ts_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,10 @@ def gen_web_wrapper():
lines.append(" getSharedAnimationEval(): boolean { return false; }")
lines.append(" getSkinningMode(): number { return 0; }")
lines.append(" getStaticBatchingEnabled(): boolean { return false; }")
lines.append(" getMaxStaticBatchVertices(): number { return 50000; }")
lines.append(" getMaxBonesPerMesh(): number { return 128; }")
lines.append(" getShadowStrength(): number { return 0.65; }")
lines.append(" getShadowAutoDisableThreshold(): number { return 10000; }")
lines.append("")
lines.append(" setAnimationLodDistance(_distance: number): number { return 0; }")
lines.append(" setAnimationLodSkipDistance(_distance: number): number { return 0; }")
Expand All @@ -1340,7 +1344,11 @@ def gen_web_wrapper():
lines.append(" setShadowBias(_bias: number): number { return 0; }")
lines.append(" setShadowMapSize(_size: number): number { return 0; }")
lines.append(" setShadowsEnabled(_enabled: boolean): number { return 0; }")
lines.append(" setShadowStrength(_strength: number): number { return 0; }")
lines.append(" setShadowAutoDisableThreshold(_threshold: number): number { return 0; }")
lines.append(" setStaticBatchingEnabled(_enabled: boolean): number { return 0; }")
lines.append(" setMaxStaticBatchVertices(_vertices: number): number { return 0; }")
lines.append(" setMaxBonesPerMesh(_bones: number): number { return 0; }")
lines.append("")
lines.append(" // TODO: wasm coordinate origin -- these stub methods satisfy the IGoudGame interface")
lines.append(" setCoordinateOrigin(_origin: number): boolean { return true; }")
Expand Down
40 changes: 40 additions & 0 deletions codegen/generated/goud_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,26 @@ int32_t goud_renderer3d_get_shadow_map_size(struct GoudContextId context_id);
*/
float goud_renderer3d_get_shadow_bias(struct GoudContextId context_id);

/**
* Returns the maximum vertex count for static batching, or -1 on error.
*/
int32_t goud_renderer3d_get_max_static_batch_vertices(struct GoudContextId context_id);

/**
* Returns the maximum bones per mesh, or -1 on error.
*/
int32_t goud_renderer3d_get_max_bones_per_mesh(struct GoudContextId context_id);

/**
* Returns the shadow strength (0.0-1.0), or -1.0 on error.
*/
float goud_renderer3d_get_shadow_strength(struct GoudContextId context_id);

/**
* Returns the vertex threshold for shadow auto-disable, or -1 on error.
*/
int32_t goud_renderer3d_get_shadow_auto_disable_threshold(struct GoudContextId context_id);

/**
* Enables or disables frustum culling.
*/
Expand Down Expand Up @@ -2488,6 +2508,26 @@ int32_t goud_renderer3d_set_shadow_map_size(struct GoudContextId context_id, uin
*/
int32_t goud_renderer3d_set_shadow_bias(struct GoudContextId context_id, float bias);

/**
* Sets the maximum vertex count for static batching.
*/
int32_t goud_renderer3d_set_max_static_batch_vertices(struct GoudContextId context_id, uint32_t vertices);

/**
* Sets the maximum bones per mesh for skeletal animation.
*/
int32_t goud_renderer3d_set_max_bones_per_mesh(struct GoudContextId context_id, uint32_t bones);

/**
* Sets the shadow strength (darkness, 0.0 = invisible, 1.0 = fully opaque).
*/
int32_t goud_renderer3d_set_shadow_strength(struct GoudContextId context_id, float strength);

/**
* Sets the vertex threshold at which shadows are automatically disabled.
*/
int32_t goud_renderer3d_set_shadow_auto_disable_threshold(struct GoudContextId context_id, uint32_t threshold);

/**
* Returns the number of draw calls issued during the last `render()` call.
*/
Expand Down
112 changes: 112 additions & 0 deletions codegen/goud_sdk.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5790,6 +5790,74 @@
"params": [],
"returns": "f32"
},
{
"name": "setMaxStaticBatchVertices",
"doc": "Sets the maximum vertex count for static batching",
"params": [
{
"name": "vertices",
"type": "u32"
}
],
"returns": "i32"
},
{
"name": "getMaxStaticBatchVertices",
"doc": "Returns the maximum vertex count for static batching",
"params": [],
"returns": "i32"
},
{
"name": "setMaxBonesPerMesh",
"doc": "Sets the maximum bones per mesh for skeletal animation",
"params": [
{
"name": "bones",
"type": "u32"
}
],
"returns": "i32"
},
{
"name": "getMaxBonesPerMesh",
"doc": "Returns the maximum bones per mesh",
"params": [],
"returns": "i32"
},
{
"name": "setShadowStrength",
"doc": "Sets the shadow strength (darkness, 0.0-1.0)",
"params": [
{
"name": "strength",
"type": "f32"
}
],
"returns": "i32"
},
{
"name": "getShadowStrength",
"doc": "Returns the shadow strength (0.0-1.0)",
"params": [],
"returns": "f32"
},
{
"name": "setShadowAutoDisableThreshold",
"doc": "Sets the vertex threshold at which shadows are automatically disabled",
"params": [
{
"name": "threshold",
"type": "u32"
}
],
"returns": "i32"
},
{
"name": "getShadowAutoDisableThreshold",
"doc": "Returns the vertex threshold for shadow auto-disable",
"params": [],
"returns": "i32"
},
{
"name": "instantiateModelBatch",
"doc": "Creates multiple instances of a model in one call",
Expand Down Expand Up @@ -13158,6 +13226,50 @@
"ffi": "goud_renderer3d_get_shadow_bias",
"returns": "f32"
},
"setMaxStaticBatchVertices": {
"ffi": "goud_renderer3d_set_max_static_batch_vertices",
"params": {
"vertices": "u32"
},
"returns": "i32"
},
"getMaxStaticBatchVertices": {
"ffi": "goud_renderer3d_get_max_static_batch_vertices",
"returns": "i32"
},
"setMaxBonesPerMesh": {
"ffi": "goud_renderer3d_set_max_bones_per_mesh",
"params": {
"bones": "u32"
},
"returns": "i32"
},
"getMaxBonesPerMesh": {
"ffi": "goud_renderer3d_get_max_bones_per_mesh",
"returns": "i32"
},
"setShadowStrength": {
"ffi": "goud_renderer3d_set_shadow_strength",
"params": {
"strength": "f32"
},
"returns": "i32"
},
"getShadowStrength": {
"ffi": "goud_renderer3d_get_shadow_strength",
"returns": "f32"
},
"setShadowAutoDisableThreshold": {
"ffi": "goud_renderer3d_set_shadow_auto_disable_threshold",
"params": {
"threshold": "u32"
},
"returns": "i32"
},
"getShadowAutoDisableThreshold": {
"ffi": "goud_renderer3d_get_shadow_auto_disable_threshold",
"returns": "i32"
},
"instantiateModelBatch": {
"ffi": "goud_renderer3d_instantiate_model_batch",
"unsafe": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Bird(game: GoudGame) {
if (game.isKeyJustPressed(Key.Space)) return true

// Gamepad input: A/South button on gamepad 0.
if (game.isGamepadButtonJustPressed(0, GamepadButton.South)) return true
if (game.isGamepadButtonJustPressed(0, GamepadButton.South.value)) return true

return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class GameManager(game: GoudGame) {
// Keyboard (emulator)
if (game.isKeyJustPressed(Key.Space)) return true
// Gamepad A/South button
if (game.isGamepadButtonJustPressed(0, GamepadButton.South)) return true
if (game.isGamepadButtonJustPressed(0, GamepadButton.South.value)) return true
return false
}

Expand Down
35 changes: 35 additions & 0 deletions goud_engine/src/ffi/renderer3d/environment/config_getters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,38 @@ pub extern "C" fn goud_renderer3d_get_shadow_map_size(context_id: GoudContextId)
pub extern "C" fn goud_renderer3d_get_shadow_bias(context_id: GoudContextId) -> f32 {
with_renderer(context_id, |r| r.render_config().shadows.bias).unwrap_or(-1.0)
}

/// Returns the maximum vertex count for static batching, or -1 on error.
#[no_mangle]
pub extern "C" fn goud_renderer3d_get_max_static_batch_vertices(context_id: GoudContextId) -> i32 {
with_renderer(context_id, |r| {
r.render_config().batching.max_static_batch_vertices as i32
})
.unwrap_or(-1)
}

/// Returns the maximum bones per mesh, or -1 on error.
#[no_mangle]
pub extern "C" fn goud_renderer3d_get_max_bones_per_mesh(context_id: GoudContextId) -> i32 {
with_renderer(context_id, |r| {
r.render_config().skinning.max_bones_per_mesh as i32
})
.unwrap_or(-1)
}

/// Returns the shadow strength (0.0-1.0), or -1.0 on error.
#[no_mangle]
pub extern "C" fn goud_renderer3d_get_shadow_strength(context_id: GoudContextId) -> f32 {
with_renderer(context_id, |r| r.render_config().shadows.shadow_strength).unwrap_or(-1.0)
}

/// Returns the vertex threshold for shadow auto-disable, or -1 on error.
#[no_mangle]
pub extern "C" fn goud_renderer3d_get_shadow_auto_disable_threshold(
context_id: GoudContextId,
) -> i32 {
with_renderer(context_id, |r| {
r.render_config().shadows.auto_disable_vertex_threshold as i32
})
.unwrap_or(-1)
}
Loading
Loading