drm: add pumpkin_man
This commit is contained in:
parent
9286199243
commit
96091089d9
1177
drm/pumpkin_man.c
Normal file
1177
drm/pumpkin_man.c
Normal file
File diff suppressed because it is too large
Load Diff
67
drm/pumpkin_man.vs.asm
Normal file
67
drm/pumpkin_man.vs.asm
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
-- CONST[0] = {0.159155, 0.5, 6.283185, -3.141593}
|
||||||
|
-- CONST[1] = {theta1, theta2, 0.2, 0.5}
|
||||||
|
-- CONST[2] = {1.33333, 0, 0, 0}
|
||||||
|
|
||||||
|
-- each instruction is only allowed to use a single unique `const` address
|
||||||
|
--
|
||||||
|
-- instructions may use multiple `temp` addresses, so const[1] is moved to
|
||||||
|
-- temp[0]:
|
||||||
|
--
|
||||||
|
temp[0].xy = VE_ADD const[1].xy__ const[1].00__ ;
|
||||||
|
|
||||||
|
-- ME_SIN and ME_COS clamp their inputs to [-π,+π] prior to the sin/cos
|
||||||
|
-- calculation.
|
||||||
|
--
|
||||||
|
-- This 3-instruction sequence remaps the range [-∞,+∞] to [-π,+π]
|
||||||
|
temp[0].xy = VE_MAD temp[0].xy__ const[0].xx__ const[0].yy__ ;
|
||||||
|
temp[0].xy = VE_FRC temp[0].xy__ ;
|
||||||
|
temp[0].xy = VE_MAD temp[0].xy__ const[0].zz__ const[0].ww__ ;
|
||||||
|
|
||||||
|
-- sin and cos
|
||||||
|
temp[3].x = ME_SIN temp[0].___x ;
|
||||||
|
temp[3].y = ME_COS temp[0].___x ;
|
||||||
|
temp[3].z = ME_SIN temp[0].___y ;
|
||||||
|
temp[3].w = ME_COS temp[0].___y ;
|
||||||
|
|
||||||
|
-- temp[3] now contains:
|
||||||
|
-- temp[3] = {sin(theta1), cos(theta1), sin(theta2), cos(theta2)}
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
-- first rotation: X-axis rotation:
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- y_ = (-z0 * st1)
|
||||||
|
-- z_ = ( z0 * ct1)
|
||||||
|
temp[1].yz = VE_MUL input[0]._-zz_ temp[3]._xy_ ;
|
||||||
|
|
||||||
|
-- x1 = (x0 * 1 + 0)
|
||||||
|
-- y1 = (y0 * ct1 + nz0st1)
|
||||||
|
-- z1 = (y0 * st1 + z0ct1)
|
||||||
|
temp[1].xyz = VE_MAD input[0].xyy_ temp[3].1yx_ temp[1].0yz_ ;
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
-- second rotation: Y-axis rotation:
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- x_ = (-z1 * st2)
|
||||||
|
-- z_ = ( z1 * ct2)
|
||||||
|
temp[2].xz = VE_MUL temp[1].-z_z_ temp[3].z_w_ ;
|
||||||
|
|
||||||
|
-- x2 = (x1 * ct2 + nz1st2)
|
||||||
|
-- y2 = (y1 * 1 + 0)
|
||||||
|
-- z2 = (x1 * st2 + z1ct2)
|
||||||
|
temp[2].xyz = VE_MAD temp[1].xyx_ temp[3].w1z_ temp[2].x0z_ ;
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
-- scale
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
temp[3].xyz = VE_MAD temp[2].xyz_ const[1].zzz_ const[1].00w_ ;
|
||||||
|
temp[3].x = VE_MUL temp[3].x___ const[2].x___;
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
-- output
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
out[0].xyzw = VE_MUL temp[3].xyzz temp[3].11-z1 ;
|
||||||
|
out[1].xyzw = VE_ADD input[1].xyzw input[1].0000 ;
|
||||||
16
drm/pumpkin_man.vs.inc
Normal file
16
drm/pumpkin_man.vs.inc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
0x00300003, 0x01f90022, 0x01fc8022, 0x01ffe022,
|
||||||
|
0x00300004, 0x01f90000, 0x01f80002, 0x01f92002,
|
||||||
|
0x00300006, 0x01f90000, 0x01ffe000, 0x01ffe000,
|
||||||
|
0x00300004, 0x01f90000, 0x01fa4002, 0x01fb6002,
|
||||||
|
0x00106050, 0x003fe000, 0x01ffe000, 0x01ffe000,
|
||||||
|
0x00206051, 0x003fe000, 0x01ffe000, 0x01ffe000,
|
||||||
|
0x00406050, 0x007fe000, 0x01ffe000, 0x01ffe000,
|
||||||
|
0x00806051, 0x007fe000, 0x01ffe000, 0x01ffe000,
|
||||||
|
0x00602002, 0x05d2e001, 0x01c8e060, 0x01ffe060,
|
||||||
|
0x00702004, 0x01c90001, 0x01c1a060, 0x01d18020,
|
||||||
|
0x00504002, 0x03d74020, 0x01df4060, 0x01ffe060,
|
||||||
|
0x00704080, 0x01c10020, 0x01d56060, 0x01d40040,
|
||||||
|
0x00706004, 0x01d10040, 0x01d24022, 0x01dc8022,
|
||||||
|
0x00106002, 0x01ff0060, 0x01ff0042, 0x01ffe042,
|
||||||
|
0x00f02203, 0x00d10021, 0x01248021, 0x01ffe021,
|
||||||
|
0x00f00202, 0x00910060, 0x0955a060, 0x01ffe060,
|
||||||
66
model/model.h
Normal file
66
model/model.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct vec3 {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
};
|
||||||
|
struct vec2 {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct vec3 vertex_position;
|
||||||
|
typedef struct vec2 vertex_texture;
|
||||||
|
typedef struct vec3 vertex_normal;
|
||||||
|
|
||||||
|
struct index_ptn {
|
||||||
|
uint16_t position;
|
||||||
|
uint16_t texture;
|
||||||
|
uint16_t normal;
|
||||||
|
};
|
||||||
|
|
||||||
|
union triangle {
|
||||||
|
struct {
|
||||||
|
struct index_ptn a;
|
||||||
|
struct index_ptn b;
|
||||||
|
struct index_ptn c;
|
||||||
|
};
|
||||||
|
struct index_ptn v[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
union quadrilateral {
|
||||||
|
struct {
|
||||||
|
struct index_ptn a;
|
||||||
|
struct index_ptn b;
|
||||||
|
struct index_ptn c;
|
||||||
|
struct index_ptn d;
|
||||||
|
};
|
||||||
|
struct index_ptn v[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
union line {
|
||||||
|
struct {
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
};
|
||||||
|
int v[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct object {
|
||||||
|
const union triangle * triangle;
|
||||||
|
const union quadrilateral * quadrilateral;
|
||||||
|
const union line * line;
|
||||||
|
const int triangle_count;
|
||||||
|
const int quadrilateral_count;
|
||||||
|
const int line_count;
|
||||||
|
const int material;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct model {
|
||||||
|
const vertex_position * position;
|
||||||
|
const vertex_texture * texture;
|
||||||
|
const vertex_normal * normal;
|
||||||
|
const struct object ** object;
|
||||||
|
const int object_count;
|
||||||
|
};
|
||||||
79552
model/pumpkin/pumpkin.h
Normal file
79552
model/pumpkin/pumpkin.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user