Update some test code
This commit is contained in:
parent
7462d731f1
commit
776f198df3
1 changed files with 42 additions and 7 deletions
|
@ -227,8 +227,7 @@ void CWaterEnvMap::doInit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *testMeshVPstr =
|
||||||
static CVertexProgram testMeshVP(
|
|
||||||
"!!VP1.0\n\
|
"!!VP1.0\n\
|
||||||
DP4 o[HPOS].x, c[0], v[0]; \n\
|
DP4 o[HPOS].x, c[0], v[0]; \n\
|
||||||
DP4 o[HPOS].y, c[1], v[0]; \n\
|
DP4 o[HPOS].y, c[1], v[0]; \n\
|
||||||
|
@ -236,8 +235,45 @@ static CVertexProgram testMeshVP(
|
||||||
DP4 o[HPOS].w, c[3], v[0]; \n\
|
DP4 o[HPOS].w, c[3], v[0]; \n\
|
||||||
MAD o[COL0], v[8], c[4].xxxx, c[4].yyyy; \n\
|
MAD o[COL0], v[8], c[4].xxxx, c[4].yyyy; \n\
|
||||||
MOV o[TEX0], v[8]; \n\
|
MOV o[TEX0], v[8]; \n\
|
||||||
END"
|
END";
|
||||||
);
|
|
||||||
|
|
||||||
|
class CVertexProgramTestMeshVP : public CVertexProgram
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct CIdx
|
||||||
|
{
|
||||||
|
uint ProgramConstant0;
|
||||||
|
};
|
||||||
|
CVertexProgramTestMeshVP()
|
||||||
|
{
|
||||||
|
// nelvp
|
||||||
|
{
|
||||||
|
CSource *source = new CSource();
|
||||||
|
source->Profile = nelvp;
|
||||||
|
source->DisplayName = "testMeshVP/nelvp";
|
||||||
|
source->setSourcePtr(testMeshVPstr);
|
||||||
|
source->ParamIndices["modelViewProjection"] = 0;
|
||||||
|
source->ParamIndices["programConstant0"] = 4;
|
||||||
|
addSource(source);
|
||||||
|
}
|
||||||
|
// TODO_VP_GLSL
|
||||||
|
}
|
||||||
|
virtual ~CVertexProgramTestMeshVP()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
virtual void buildInfo()
|
||||||
|
{
|
||||||
|
m_Idx.ProgramConstant0 = getUniformIndex("programConstant0");
|
||||||
|
}
|
||||||
|
inline const CIdx &idx() { return m_Idx; }
|
||||||
|
private:
|
||||||
|
CIdx m_Idx;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static CVertexProgramTestMeshVP testMeshVP;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,10 +296,9 @@ void CWaterEnvMap::renderTestMesh(IDriver &driver)
|
||||||
driver.activeVertexProgram(&testMeshVP);
|
driver.activeVertexProgram(&testMeshVP);
|
||||||
driver.activeVertexBuffer(_TestVB);
|
driver.activeVertexBuffer(_TestVB);
|
||||||
driver.activeIndexBuffer(_TestIB);
|
driver.activeIndexBuffer(_TestIB);
|
||||||
driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); // tmp
|
|
||||||
_MaterialPassThruZTest.setTexture(0, _EnvCubic);
|
_MaterialPassThruZTest.setTexture(0, _EnvCubic);
|
||||||
driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity);
|
driver.setUniformMatrix(IDriver::VertexProgram, testMeshVP.getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity);
|
||||||
driver.setConstant(4, 2.f, 1.f, 0.f, 0.f);
|
driver.setUniform2f(IDriver::VertexProgram, testMeshVP.idx().ProgramConstant0, 2.f, 1.f);
|
||||||
//driver.renderTriangles(testMat, 0, TEST_VB_NUM_TRIS);
|
//driver.renderTriangles(testMat, 0, TEST_VB_NUM_TRIS);
|
||||||
driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS);
|
driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS);
|
||||||
driver.activeVertexProgram(NULL);
|
driver.activeVertexProgram(NULL);
|
||||||
|
|
Loading…
Reference in a new issue