CODE
//sets vertex feed configuration
p=pb_begin();
pb_push(p++,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(0),16);
for(i=0;i<16;i++) *(p++)=2; //resets array (nothing goes to v0-v15)
pb_end(p);
//declares that 3 floats will go into v0 (3D position) (stride for optional batch processing : +8*4)
//declares that 3 floats will go into v3 (3D normal) (stride for optional batch processing : +8*4)
//declares that 2 floats will go into v7 (2D texture coordinates) (stride for optional batch processing : +8*4)
//(check your intermediate assembler file .vsh to see what ATTR:n is expected)
//stride 0x20=4*8=4*(3+3+2) is the offset that allows batch processing to find next value in a data stream
p=pb_begin();
pb_push1(p,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(0),0x2032); p+=2;
pb_push1(p,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(3),0x2032); p+=2;
pb_push1(p,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(7),0x2022); p+=2;
pb_end(p);
//read vs.cg for hints about how to create vs.h
#include "vs.h"
p=pb_begin();
p=pb_push_mcode(p,pb_pcode2mcode(g_vs11_main));
pb_end(p);
//read ps.cg for hints about how to create ps.h
#include "ps.h"
p=pb_begin();
p=pb_push_mcode(p,pb_pcode2mcode(g_ps11_main));
pb_end(p);