public override void RenderingConfigurationChanged(RenderingConfigurator conf) { renderingConfiguration = conf; if (LasDataManager.ColorPallette != null) { LasDataManager.ColorPallette.ColorMode = renderingConfiguration.colorType; } selectedTexture = (int)renderingConfiguration.pointTexture; CgGl.cgGLSetParameter1f(m_CGparam_sizeFactorPass1, renderingConfiguration.pointSize); checkForCgError("setting sizeFactor"); CgGl.cgGLSetParameter1f(m_CGparam_sizeFactorPass2, renderingConfiguration.pointSize); checkForCgError("setting sizeFactor2"); CgGl.cgGLSetParameter1f(m_CGparam_zoffsetPass1, renderingConfiguration.Zoffset); checkForCgError("setting zoffset"); CgGl.cgGLSetParameter1f(m_CGparam_splatRotationCutoffDistPass1, renderingConfiguration.splatRotationCutoffDistance); checkForCgError("setting splatRotationCutoffDistancePass1"); CgGl.cgGLSetParameter1f(m_CGparam_splatRotationCutoffDistPass2, renderingConfiguration.splatRotationCutoffDistance); checkForCgError("setting splatRotationCutoffDistancePass2"); }
private void InitCg() { m_CG_vertexProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_VERTEX); CgGl.cgGLSetOptimalOptions(m_CG_vertexProfile); checkForCgError("selecting vertex profile"); m_CG_fragmentProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_FRAGMENT); CgGl.cgGLSetOptimalOptions(m_CG_fragmentProfile); checkForCgError("selecting fragment profile"); // Create the context... m_CGcontext = Cg.cgCreateContext(); checkForCgError("creating context"); string cas = Application.StartupPath; //load pass1 m_CGp_vertexProgramPass1 = Cg.cgCreateProgramFromFile(m_CGcontext, Cg.CG_SOURCE, cas + "/SpriteVertexProgram.cg", m_CG_vertexProfile, "main_pass1", null); checkForCgError("creating vertex program pass1 from file SpriteVertexProgram.cg"); CgGl.cgGLLoadProgram(m_CGp_vertexProgramPass1); checkForCgError("loading vertex program"); m_CGp_fragmentProgramPass1 = Cg.cgCreateProgramFromFile(m_CGcontext, Cg.CG_SOURCE, cas + "/SpriteFragmentProgram.cg", m_CG_fragmentProfile, "main_pass1", null); checkForCgError("creating fragment program from file SpriteFragmentProgram.cg"); CgGl.cgGLLoadProgram(m_CGp_fragmentProgramPass1); checkForCgError("loading fragment program"); //load pass2 m_CGp_vertexProgramPass2 = Cg.cgCreateProgramFromFile(m_CGcontext, Cg.CG_SOURCE, cas + "/SpriteVertexProgram.cg", m_CG_vertexProfile, "main_pass2", null); checkForCgError("creating vertex program pass2 from file SpriteVertexProgram.cg"); CgGl.cgGLLoadProgram(m_CGp_vertexProgramPass2); checkForCgError("loading vertex program"); m_CGp_fragmentProgramPass2 = Cg.cgCreateProgramFromFile(m_CGcontext, Cg.CG_SOURCE, cas + "/SpriteFragmentProgram.cg", m_CG_fragmentProfile, "main_pass2", null); checkForCgError("creating fragment program from file SpriteFragmentProgram.cg"); CgGl.cgGLLoadProgram(m_CGp_fragmentProgramPass2); checkForCgError("loading fragment program"); //load pass3 m_CGp_vertexProgramPass3 = Cg.cgCreateProgramFromFile(m_CGcontext, Cg.CG_SOURCE, cas + "/SpriteVertexProgram.cg", m_CG_vertexProfile, "main_pass3", null); checkForCgError("creating vertex program pass3 from file SpriteVertexProgram.cg"); CgGl.cgGLLoadProgram(m_CGp_vertexProgramPass3); checkForCgError("loading vertex program"); m_CGp_fragmentProgramPass3 = Cg.cgCreateProgramFromFile(m_CGcontext, Cg.CG_SOURCE, cas + "/SpriteFragmentProgram.cg", m_CG_fragmentProfile, "main_pass3", null); checkForCgError("creating fragment program from file SpriteFragmentProgram.cg"); CgGl.cgGLLoadProgram(m_CGp_fragmentProgramPass3); checkForCgError("loading fragment pass3 program"); //pass1 parameters m_CGparam_modelViewProjPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "modelViewProj"); checkForCgError("getting modal view proj"); m_CGparam_modelViewITPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "modelViewIT"); checkForCgError("getting modal view IT"); m_CGparam_modelViewPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "modelView"); checkForCgError("getting modal view"); m_CGparam_eyePositionPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "eyePos"); checkForCgError("getting eyePos"); m_CGparam_sizeFactorPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "sizeFactor"); checkForCgError("getting sizeFactor"); m_CGparam_zoffsetPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "zoffset"); checkForCgError("getting zoffset"); CgGl.cgGLSetParameter1f(m_CGparam_zoffsetPass1, 0.003f); checkForCgError("setting zoffset"); m_CGparam_splatRotationCutoffDistPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "splatRotationCutoffDist"); checkForCgError("getting splatRotationCutoffDist"); CgGl.cgGLSetParameter1f(m_CGparam_zoffsetPass1, 0.003f); checkForCgError("setting zoffset"); m_CGparam_farcullPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "farcull"); checkForCgError("getting farcull"); CgGl.cgGLSetParameter1f(m_CGparam_farcullPass1, WorldView.farCull); checkForCgError("setting farcull"); m_CGparam_viewParamsPass1 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass1, "viewParams"); checkForCgError("getting viewParams"); //pass2 parameters m_CGparam_modelViewProjPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "modelViewProj"); checkForCgError("getting modal view proj2"); m_CGparam_modelViewITPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "modelViewIT"); checkForCgError("getting modal view IT2"); m_CGparam_modelViewPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "modelView"); checkForCgError("getting modal view2"); m_CGparam_eyePositionPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "eyePos"); checkForCgError("getting eyePos2"); m_CGparam_sizeFactorPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "sizeFactor"); checkForCgError("getting sizeFactor2"); m_CGparam_splatRotationCutoffDistPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "splatRotationCutoffDist"); checkForCgError("getting splatRotationCutoffDist"); CgGl.cgGLSetParameter1f(m_CGparam_sizeFactorPass1, 1f); checkForCgError("setting sizeFactor"); CgGl.cgGLSetParameter1f(m_CGparam_sizeFactorPass2, 1f); checkForCgError("setting sizeFactor2"); m_CGparam_farcullPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "farcull"); checkForCgError("getting farcull"); CgGl.cgGLSetParameter1f(m_CGparam_farcullPass2, WorldView.farCull); checkForCgError("setting farcull"); m_CGparam_viewParamsPass2 = Cg.cgGetNamedParameter(m_CGp_vertexProgramPass2, "viewParams"); checkForCgError("getting viewParams"); }