src/ascension/scene_node.h

changeset 102
0d94fd280c6e
parent 95
622887f7e954
--- a/src/ascension/scene_node.h	Tue Apr 29 21:51:29 2025 +0200
+++ b/src/ascension/scene_node.h	Thu May 01 15:26:01 2025 +0200
@@ -54,7 +54,6 @@
     CxList *behaviors;
     asc_scene_free_func free_func;
     asc_scene_update_func update_func;
-    unsigned depth; // TODO: do we really need this bullshit?
     asc_vec3f position;
     asc_vec3f rotation;
     asc_vec3f scale;
@@ -175,6 +174,12 @@
 void asc_node_update_transform(AscSceneNode *node);
 
 
+/**
+ * This is the z-position a simple 2D element should have to allow
+ * stacking 2D elements with depth-test.
+ */
+#define ASC_SCENE_2D_DEPTH_OFFSET 0.0078125f
+
 __attribute__((__nonnull__)) static inline
 void asc_set_position(AscSceneNode *node, float x, float y, float z) {
     node->position.x = x;
@@ -187,7 +192,6 @@
 void asc_set_position2d(AscSceneNode *node, int x, int y) {
     node->position.x = (float)x;
     node->position.y = (float)y;
-    node->position.z = 0.f;
     asc_node_update_transform(node);
 }
 
@@ -208,7 +212,6 @@
 void asc_set_scale2d(AscSceneNode *node, int width, int height) {
     node->scale.width = (float)width;
     node->scale.height = (float)height;
-    node->scale.depth = 1.f;
     asc_node_update_transform(node);
 }
 

mercurial