From 5fbb220795937d2914c568bad6ea2eb4edd6a8ed Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 10 Sep 2013 16:42:51 +0200 Subject: [PATCH] Update some test code --HG-- branch : multipass-stereo --- code/nel/src/3d/water_env_map.cpp | 49 ++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/code/nel/src/3d/water_env_map.cpp b/code/nel/src/3d/water_env_map.cpp index 3d2f64a1f..65f66e622 100644 --- a/code/nel/src/3d/water_env_map.cpp +++ b/code/nel/src/3d/water_env_map.cpp @@ -227,8 +227,7 @@ void CWaterEnvMap::doInit() } } - -static CVertexProgram testMeshVP( +static const char *testMeshVPstr = "!!VP1.0\n\ DP4 o[HPOS].x, c[0], 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\ MAD o[COL0], v[8], c[4].xxxx, c[4].yyyy; \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.activeVertexBuffer(_TestVB); driver.activeIndexBuffer(_TestIB); - driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); // tmp _MaterialPassThruZTest.setTexture(0, _EnvCubic); - driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); - driver.setConstant(4, 2.f, 1.f, 0.f, 0.f); + driver.setUniformMatrix(IDriver::VertexProgram, testMeshVP.getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); + driver.setUniform2f(IDriver::VertexProgram, testMeshVP.idx().ProgramConstant0, 2.f, 1.f); //driver.renderTriangles(testMat, 0, TEST_VB_NUM_TRIS); driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS); driver.activeVertexProgram(NULL);