From 87d4751a871eeb6b78e33c6117895d92f79db3db Mon Sep 17 00:00:00 2001 From: fincs Date: Sat, 7 Mar 2015 17:02:38 +0100 Subject: [PATCH] C3D_DepthRange() -> C3D_DepthMap() --- include/c3d/effect.h | 2 +- source/base.c | 2 +- source/context.h | 2 +- source/effect.c | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/c3d/effect.h b/include/c3d/effect.h index 7bb2ba2..d9ce9e9 100644 --- a/include/c3d/effect.h +++ b/include/c3d/effect.h @@ -1,7 +1,7 @@ #pragma once #include "types.h" -void C3D_DepthRange(float near, float far); +void C3D_DepthMap(float zScale, float zOffset); void C3D_CullFace(GPU_CULLMODE mode); void C3D_StencilTest(bool enable, GPU_TESTFUNC function, int ref, int mask, int replace); void C3D_StencilOp(GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass); diff --git a/source/base.c b/source/base.c index 48abea0..4d384b6 100644 --- a/source/base.c +++ b/source/base.c @@ -63,7 +63,7 @@ bool C3D_Init(size_t cmdBufSize) ctx->flags = C3DiF_Active | C3DiF_TexEnvAll | C3DiF_Effect | C3DiF_TexAll; // TODO: replace with direct struct access - C3D_DepthRange(-1.0f, 0.0f); + C3D_DepthMap(-1.0f, 0.0f); C3D_CullFace(GPU_CULL_BACK_CCW); C3D_StencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00); C3D_StencilOp(GPU_KEEP, GPU_KEEP, GPU_KEEP); diff --git a/source/context.h b/source/context.h index 99df6a8..ac7ea07 100644 --- a/source/context.h +++ b/source/context.h @@ -9,7 +9,7 @@ typedef struct { - u32 drNear, drFar; + u32 zScale, zOffset; GPU_CULLMODE cullMode; u32 alphaTest; diff --git a/source/effect.c b/source/effect.c index f0418ad..c703d91 100644 --- a/source/effect.c +++ b/source/effect.c @@ -7,11 +7,11 @@ static inline C3D_Effect* getEffect() return &ctx->effect; } -void C3D_DepthRange(float near, float far) +void C3D_DepthMap(float zScale, float zOffset) { C3D_Effect* e = getEffect(); - e->drNear = C3Di_Float24(near); - e->drFar = C3Di_Float24(far); + e->zScale = C3Di_Float24(zScale); + e->zOffset = C3Di_Float24(zOffset); } void C3D_CullFace(GPU_CULLMODE mode) @@ -60,7 +60,7 @@ void C3Di_EffectBind(C3D_Effect* e) { GPUCMD_AddWrite(GPUREG_006D, 0x00000001); GPUCMD_AddWrite(GPUREG_FACECULLING_CONFIG, e->cullMode & 0x3); - GPUCMD_AddIncrementalWrites(GPUREG_DEPTHRANGE_NEAR, (u32*)&e->drNear, 2); + GPUCMD_AddIncrementalWrites(GPUREG_DEPTHMAP_SCALE, (u32*)&e->zScale, 2); GPUCMD_AddIncrementalWrites(GPUREG_ALPHATEST_CONFIG, (u32*)&e->alphaTest, 4); GPUCMD_AddWrite(GPUREG_BLEND_COLOR, e->blendClr); GPUCMD_AddWrite(GPUREG_BLEND_CONFIG, e->alphaBlend);