diff options
author | WlodekM <[email protected]> | 2024-06-16 10:35:45 +0300 |
---|---|---|
committer | WlodekM <[email protected]> | 2024-06-16 10:35:45 +0300 |
commit | abef6da56913f1c55528103e60a50451a39628b1 (patch) | |
tree | b3c8092471ecbb73e568cd0d336efa0e7871ee8d /misc/xbox |
initial commit
Diffstat (limited to 'misc/xbox')
-rw-r--r-- | misc/xbox/Makefile | 13 | ||||
-rw-r--r-- | misc/xbox/ps_coloured.ps.cg | 10 | ||||
-rw-r--r-- | misc/xbox/ps_textured.ps.cg | 12 | ||||
-rw-r--r-- | misc/xbox/vs_coloured.vs.cg | 33 | ||||
-rw-r--r-- | misc/xbox/vs_textured.vs.cg | 36 |
5 files changed, 104 insertions, 0 deletions
diff --git a/misc/xbox/Makefile b/misc/xbox/Makefile new file mode 100644 index 0000000..f3a7985 --- /dev/null +++ b/misc/xbox/Makefile @@ -0,0 +1,13 @@ +ifeq ($(strip $(NXDK_DIR)),) +$(error "Please set NXDK_DIR in your environment") +endif + +XBE_TITLE = ClassiCube +GEN_XISO = ClassiCube-xbox.iso +SRCS = $(wildcard src/*.c) $(wildcard third_party/bearssl/src/*.c) +SHADER_OBJS = misc/xbox/vs_coloured.inl misc/xbox/vs_textured.inl misc/xbox/ps_coloured.inl misc/xbox/ps_textured.inl +NXDK_NET = y +NXDK_CFLAGS = -Ithird_party/bearssl/inc -O1 +NXDK_LDFLAGS = -stack:196608 + +include $(NXDK_DIR)/Makefile \ No newline at end of file diff --git a/misc/xbox/ps_coloured.ps.cg b/misc/xbox/ps_coloured.ps.cg new file mode 100644 index 0000000..aec8b40 --- /dev/null +++ b/misc/xbox/ps_coloured.ps.cg @@ -0,0 +1,10 @@ +struct vOut { + float4 color : COLOR; +}; + +float4 main( + vOut input + ) : COLOR +{ + return input.color; +} diff --git a/misc/xbox/ps_textured.ps.cg b/misc/xbox/ps_textured.ps.cg new file mode 100644 index 0000000..19d4f9e --- /dev/null +++ b/misc/xbox/ps_textured.ps.cg @@ -0,0 +1,12 @@ +struct vOut { + float4 color : COLOR; + float2 tex0 : TEXCOORD0; +}; + +float4 main( + vOut input, + uniform sampler2D tex + ) : COLOR +{ + return tex2D(tex, input.tex0.xy) * input.color; +} diff --git a/misc/xbox/vs_coloured.vs.cg b/misc/xbox/vs_coloured.vs.cg new file mode 100644 index 0000000..f006be4 --- /dev/null +++ b/misc/xbox/vs_coloured.vs.cg @@ -0,0 +1,33 @@ +struct vIn { + float4 color : DIFFUSE; + float4 position : POSITION; +}; + +struct vOut { + float4 col : COLOR; + float4 pos : POSITION; +}; + +vOut main( + vIn input, + uniform float4x4 mvp, + uniform float4 vp_scale, + uniform float4 vp_offset + ) +{ + vOut result; + float4 position; + + position = float4(input.position.xyz, 1.0f); + position = mul(position, mvp); + position.xyz = position.xyz / position.w; + + position.x = position.x * vp_scale.x + vp_offset.x; + position.y = position.y * vp_scale.y + vp_offset.y; + position.z = position.z * vp_scale.z + vp_offset.z; + //position.w = 1.0 / half_viewport.w; + + result.pos = position; + result.col = input.color; + return result; +} diff --git a/misc/xbox/vs_textured.vs.cg b/misc/xbox/vs_textured.vs.cg new file mode 100644 index 0000000..2e3b39b --- /dev/null +++ b/misc/xbox/vs_textured.vs.cg @@ -0,0 +1,36 @@ +struct vIn { + float4 tex : TEXCOORD; + float4 color : DIFFUSE; + float4 position : POSITION; +}; + +struct vOut { + float4 pos : POSITION; + float4 col : COLOR; + float4 tex : TEXCOORD0; +}; + +vOut main( + vIn input, + uniform float4x4 mvp, + uniform float4 vp_scale, + uniform float4 vp_offset + ) +{ + vOut result; + float4 position; + + position = float4(input.position.xyz, 1.0f); + position = mul(position, mvp); + position.xyz = position.xyz / position.w; + + position.x = position.x * vp_scale.x + vp_offset.x; + position.y = position.y * vp_scale.y + vp_offset.y; + position.z = position.z * vp_scale.z + vp_offset.z; + //position.w = 1.0 / half_viewport.w; + + result.pos = position; + result.col = input.color; + result.tex = input.tex; + return result; +} |