Culling improvements + GRAPH_RENDER_INVISIBLE check change (#590)
* Culling improvements + earlier GRAPH_RENDER_INVISIBLE check GRAPH_RENDER_INVISIBLE is now checked during geo_process_object before any uncessesary transformation is applied to the object, translation is still calculated for sound even if the object is invisible. Half fov is now computed during geo_process_perspective. Vertical culling has been added (only when bellow the screen to prevent shadow´s being culled). Emulators have basically infinite culling aspect ratio to prevent early culling with widescreen viewport hacks. Default culling radius is now a define. This was written by both me and Kaze Emanuar, he provided the suggestion to use absf and informed me of integer division being remarkably slow (although it´s only used once during geo_process_perspective). * Badly placed new line (major fix) * integer Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * parenthesis doesn´t affect order of operation, just for code quality Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * uncessary whitespace Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> --------- Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
This commit is contained in:
1 parent
73fad6195d
commit
16e55ad952
5 files changed
+99
-54
No files matched your search
@@ -261,7 +261,7 @@ void geo_layout_cmd_node_perspective(void) {
|
||||
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32) fov, near, far, frustumFunc, 0);
|
||||
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32) fov, near, far, frustumFunc);
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrt
|
||||
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool,
|
||||
struct GraphNodePerspective *graphNode,
|
||||
f32 fov, u16 near, u16 far,
|
||||
GraphNodeFunc nodeFunc, s32 unused) {
|
||||
GraphNodeFunc nodeFunc) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodePerspective));
|
||||
}
|
||||
@@ -83,7 +83,6 @@ struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *p
|
||||
graphNode->near = near;
|
||||
graphNode->far = far;
|
||||
graphNode->fnNode.func = nodeFunc;
|
||||
graphNode->unused = unused;
|
||||
|
||||
if (nodeFunc != NULL) {
|
||||
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
|
||||
@@ -131,10 +131,13 @@ struct GraphNodeOrthoProjection {
|
||||
*/
|
||||
struct GraphNodePerspective {
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ s32 unused;
|
||||
/*0x1C*/ f32 fov; // horizontal field of view in degrees
|
||||
/*0x20*/ u16 near; // near clipping plane
|
||||
/*0x22*/ u16 far; // far clipping plane
|
||||
/*0x18*/ f32 fov; // horizontal field of view in degrees
|
||||
/*0x1C*/ u16 near; // near clipping plane
|
||||
/*0x1E*/ u16 far; // far clipping plane
|
||||
/*0x20*/ f32 halfFovHorizontal;
|
||||
#ifdef VERTICAL_CULLING
|
||||
/*0x24*/ f32 halfFovVertical;
|
||||
#endif
|
||||
};
|
||||
|
||||
/** An entry in the master list. It is a linked list of display lists
|
||||
@@ -369,7 +372,7 @@ void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type);
|
||||
|
||||
struct GraphNodeRoot *init_graph_node_root (struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode, s16 areaIndex, s16 x, s16 y, s16 width, s16 height);
|
||||
struct GraphNodeOrthoProjection *init_graph_node_ortho_projection (struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode, f32 scale);
|
||||
struct GraphNodePerspective *init_graph_node_perspective (struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode, f32 fov, u16 near, u16 far, GraphNodeFunc nodeFunc, s32 unused);
|
||||
struct GraphNodePerspective *init_graph_node_perspective (struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode, f32 fov, u16 near, u16 far, GraphNodeFunc nodeFunc);
|
||||
struct GraphNodeStart *init_graph_node_start (struct AllocOnlyPool *pool, struct GraphNodeStart *graphNode);
|
||||
struct GraphNodeMasterList *init_graph_node_master_list (struct AllocOnlyPool *pool, struct GraphNodeMasterList *graphNode, s16 on);
|
||||
struct GraphNodeLevelOfDetail *init_graph_node_render_range (struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode, s16 minDistance, s16 maxDistance);
|
||||
|
||||
Reference in new issue
Block a user