Posted: 30th Jun 2003 8:29
i'm too lazy to actually email this... so here's your stupid pixel shader

+ Code Snippet
FVF_XYZ=0x002
FVF_DIFFUSE=0x040
FVF_TEX1=0x100

load image "tex.jpg",1

make memblock 1, 12+(8*24)
   write memblock dword 1,0,(FVF_XYZ||FVF_DIFFUSE||FVF_TEX1)
   write memblock dword 1,4,24
   write memblock dword 1,8,4
   WriteVertex( -1.0, -1.0, 0.0, 0xffff0000, 0.0, 1.0, 1 )
   WriteVertex(  1.0, -1.0, 0.0, 0xff00ff00, 1.0, 1.0, 2 )
   WriteVertex(  1.0,  1.0, 0.0, 0xff0000ff, 1.0, 0.0, 3 )
   WriteVertex( -1.0,  1.0, 0.0, 0xffffffff, 0.0, 0.0, 4 )

   make mesh from memblock 1,1 : delete mesh 1
   make object 1,1,1

create pixel shader from file 1,"PixelShader.shader"
set pixel shader texture 1,1,1
set pixel shader on 1,1
set object cull 1,0

do
   y#=y#+(4.0/screen fps()
   yrotate object 1,wrapvalue(y#)
loop


function WriteVertex( x as float, y as float, z as float, color as dword, u as float, v as float, pos as dword )
   write memblock float 1,12+(pos*24),x
   write memblock float 1,12+(pos*24)+4,y
   write memblock float 1,12+(pos*24)+8,z
   write memblock dword 1,12+(pos*24)+12,color
endfunction

remstart
// Contents of the file "PixelShader.shader"
ps_1_1          // version instruction
tex t0          // declare texture register t0,
                // to be loaded from Texture Stage 0
mul r0, v0, t0  // v0*t0, then move to r0
remend
Posted: 30th Jun 2003 20:09
What does it do?