Compare commits

...

5 Commits

Author SHA1 Message Date
Dave Murphy
9f21cf7b38
libctru 1.7.1 2023-10-28 21:06:58 +01:00
fincs
00396e8a99
Fix for libctru v2.3.0 2023-10-28 21:57:00 +02:00
oreo639
66a0594e5d Add C3D_LightEnvBumpNormalZ()
Used to configure whether the Z component of the normal map is used or if
the Z component is reconstructed based on the XY components of the normal map.
2023-08-12 16:52:36 +02:00
oreo639
e8825650c6 Correct typo in tex3ds docs 2022-08-06 11:43:21 +02:00
fincs
e2992d276f
Fix #58 2022-05-28 21:14:55 +02:00
6 changed files with 25 additions and 4 deletions

View File

@ -10,7 +10,7 @@ include $(DEVKITARM)/3ds_rules
export CITRO3D_MAJOR := 1 export CITRO3D_MAJOR := 1
export CITRO3D_MINOR := 7 export CITRO3D_MINOR := 7
export CITRO3D_PATCH := 0 export CITRO3D_PATCH := 1
VERSION := $(CITRO3D_MAJOR).$(CITRO3D_MINOR).$(CITRO3D_PATCH) VERSION := $(CITRO3D_MAJOR).$(CITRO3D_MINOR).$(CITRO3D_PATCH)

View File

@ -77,6 +77,14 @@ enum
void C3D_LightEnvFresnel(C3D_LightEnv* env, GPU_FRESNELSEL selector); void C3D_LightEnvFresnel(C3D_LightEnv* env, GPU_FRESNELSEL selector);
void C3D_LightEnvBumpMode(C3D_LightEnv* env, GPU_BUMPMODE mode); void C3D_LightEnvBumpMode(C3D_LightEnv* env, GPU_BUMPMODE mode);
void C3D_LightEnvBumpSel(C3D_LightEnv* env, int texUnit); void C3D_LightEnvBumpSel(C3D_LightEnv* env, int texUnit);
/**
* @brief Configures whether to use the z component of the normal map.
* @param[out] env Pointer to light environment structure.
* @param[in] enable false if the z component is reconstructed from the xy components
* of the normal map, true if the z component is taken from the normal map.
*/
void C3D_LightEnvBumpNormalZ(C3D_LightEnv *env, bool enable);
void C3D_LightEnvShadowMode(C3D_LightEnv* env, u32 mode); void C3D_LightEnvShadowMode(C3D_LightEnv* env, u32 mode);
void C3D_LightEnvShadowSel(C3D_LightEnv* env, int texUnit); void C3D_LightEnvShadowSel(C3D_LightEnv* env, int texUnit);
void C3D_LightEnvClampHighlights(C3D_LightEnv* env, bool clamp); void C3D_LightEnvClampHighlights(C3D_LightEnv* env, bool clamp);

View File

@ -13,7 +13,12 @@
* The one true circumference-to-radius ratio. * The one true circumference-to-radius ratio.
* See http://tauday.com/tau-manifesto * See http://tauday.com/tau-manifesto
*/ */
#define M_TAU (2*M_PI) #define M_TAU (6.28318530717958647692528676655900576)
// Define the legacy circle constant as well
#ifndef M_PI
#define M_PI (M_TAU/2)
#endif
/** /**
* @brief Convert an angle from revolutions to radians * @brief Convert an angle from revolutions to radians

View File

@ -41,7 +41,7 @@ typedef struct
}; };
} C3D_Tex; } C3D_Tex;
typedef struct ALIGN(8) typedef struct CTR_ALIGN(8)
{ {
u16 width; u16 width;
u16 height; u16 height;

View File

@ -38,7 +38,7 @@ extern "C" {
#endif #endif
/** @brief Subtexture /** @brief Subtexture
* @note If top > bottom, the subtexture is rotated 1/4 revolution counter-clockwise * @note If top < bottom, the subtexture is rotated 1/4 revolution counter-clockwise
*/ */
typedef struct Tex3DS_SubTexture typedef struct Tex3DS_SubTexture
{ {

View File

@ -250,6 +250,14 @@ void C3D_LightEnvBumpSel(C3D_LightEnv* env, int texUnit)
env->flags |= C3DF_LightEnv_Dirty; env->flags |= C3DF_LightEnv_Dirty;
} }
void C3D_LightEnvBumpNormalZ(C3D_LightEnv *env, bool usez) {
if (usez)
env->conf.config[0] |= BIT(30);
else
env->conf.config[0] &= ~BIT(30);
env->flags |= C3DF_LightEnv_Dirty;
}
void C3D_LightEnvShadowMode(C3D_LightEnv* env, u32 mode) void C3D_LightEnvShadowMode(C3D_LightEnv* env, u32 mode)
{ {
mode &= 0xF<<16; mode &= 0xF<<16;