drm: add matrix_cubesphere_cubemap

This commit is contained in:
Zack Buhman 2025-11-03 11:14:16 -06:00
parent f43ac599f9
commit 2c62869ccd
12 changed files with 3133 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
-- temp[0] -- position (world space)
-- temp[1] -- normal
-- temp[2] -- light pos (world space)
-- temp[3] -- texture
-- PIXSIZE 4
TEX TEX_SEM_WAIT TEX_SEM_ACQUIRE
temp[3].rgba = LD tex[0].rgba temp[0].rgba ;
OUT TEX_SEM_WAIT
src0.rgb = temp[3] ,
src0.a = temp[3] :
out[0].a = MAX src0.a src0.a ,
out[0].rgb = MAX src0.rgb src0.rgb ;

View File

@ -0,0 +1,42 @@
--
-- dot(m[0], v), dot(m[1], v), dot(m[2], v), dot(m[3], v)
--
-- input[0] -- position
-- input[1] -- texture
-- input[2] -- normal
-- consts[0] -- trans
-- consts[4] -- world_trans
-- consts[8] -- normal_trans
-- out[0] -- position clip space
-- out[1] -- texture
-- out[2] -- normal
-- out[3] -- object position world space
-- out[4] -- light position world space
-- position clip space
temp[1].x = VE_DOT const[0].xyzw input[0].xyzw ;
temp[1].y = VE_DOT const[1].xyzw input[0].xyzw ;
temp[1].z = VE_DOT const[2].xyzw input[0].xyzw ;
temp[1].w = VE_DOT const[3].xyzw input[0].xyzw ;
-- position world space
temp[2].xyzw = VE_ADD input[0].xyzw input[0].0000 ;
-- normal world space
temp[3].x = VE_DOT const[4].xyz0 input[2].xyz0 ;
temp[3].y = VE_DOT const[5].xyz0 input[2].xyz0 ;
temp[3].z = VE_DOT const[6].xyz0 input[2].xyz0 ;
-- position (clip space)
out[0].xyzw = VE_ADD temp[1].xyzw const[0].0000 ;
-- position (world space)
out[1].xyzw = VE_ADD temp[2].xyzw const[0].0000 ;
-- normal
out[2].xyzw = VE_ADD temp[3].xyz0 const[0].0000 ;
-- light pos (world space)
out[3].xyzw = VE_ADD const[8].xyzw const[8].0000 ;
-- texture
out[4].xyzw = VE_ADD input[1].xy00 const[0].0000 ;

109
model/cube.h Normal file
View File

@ -0,0 +1,109 @@
#pragma once
const vec3 cube_position[] = {
{1.000000f, 1.000000f, -1.000000f},
{1.000000f, -1.000000f, -1.000000f},
{1.000000f, 1.000000f, 1.000000f},
{1.000000f, -1.000000f, 1.000000f},
{-1.000000f, 1.000000f, -1.000000f},
{-1.000000f, -1.000000f, -1.000000f},
{-1.000000f, 1.000000f, 1.000000f},
{-1.000000f, -1.000000f, 1.000000f},
};
const vec2 cube_texture[] = {
{1.000000f, 0.000000f},
{0.000000f, 1.000000f},
{0.000000f, 0.000000f},
{1.000000f, 1.000000f},
};
const vec3 cube_normal[] = {
{-0.0000f, 1.0000f, -0.0000f},
{-0.0000f, -0.0000f, 1.0000f},
{-1.0000f, -0.0000f, -0.0000f},
{-0.0000f, -1.0000f, -0.0000f},
{1.0000f, -0.0000f, -0.0000f},
{-0.0000f, -0.0000f, -1.0000f},
};
const triangle_t cube_Cube_triangle[] = {
{
{4, 0, 0},
{2, 1, 0},
{0, 2, 0},
},
{
{2, 0, 1},
{7, 1, 1},
{3, 2, 1},
},
{
{6, 0, 2},
{5, 1, 2},
{7, 2, 2},
},
{
{1, 0, 3},
{7, 1, 3},
{5, 2, 3},
},
{
{0, 0, 4},
{3, 1, 4},
{1, 2, 4},
},
{
{4, 0, 5},
{1, 1, 5},
{5, 2, 5},
},
{
{4, 0, 0},
{6, 3, 0},
{2, 1, 0},
},
{
{2, 0, 1},
{6, 3, 1},
{7, 1, 1},
},
{
{6, 0, 2},
{4, 3, 2},
{5, 1, 2},
},
{
{1, 0, 3},
{3, 3, 3},
{7, 1, 3},
},
{
{0, 0, 4},
{2, 3, 4},
{3, 1, 4},
},
{
{4, 0, 5},
{0, 3, 5},
{1, 1, 5},
},
};
const object cube_Cube = {
.triangle = &cube_Cube_triangle[0],
.triangle_count = 12,
};
const object * cube_object[] = {
&cube_Cube,
};
const model cube_model = {
.position = cube_position,
.texture = cube_texture,
.normal = cube_normal,
.object = cube_object,
.object_count = 1
};

View File

@ -0,0 +1,12 @@
0x00007807,
0x02400000,
0xe400e400,
0x00000000,
0x00000000,
0x00000000,
0x00078005,
0x08020000,
0x08020000,
0x1c440220,
0x1c60c003,
0x00000005,

View File

@ -0,0 +1,16 @@
0x00100201,
0x00d10002,
0x01510001,
0x01248001,
0x00200201,
0x00d10022,
0x01510001,
0x01248001,
0x00c00201,
0x00d10062,
0x01510001,
0x01248001,
0x00702203,
0x01d10001,
0x01248001,
0x01248001,

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.