当前位置: 首页>>代码示例>>C++>>正文


C++ GpuProgramParametersSharedPtr::setNamedAutoConstant方法代码示例

本文整理汇总了C++中GpuProgramParametersSharedPtr::setNamedAutoConstant方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramParametersSharedPtr::setNamedAutoConstant方法的具体用法?C++ GpuProgramParametersSharedPtr::setNamedAutoConstant怎么用?C++ GpuProgramParametersSharedPtr::setNamedAutoConstant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GpuProgramParametersSharedPtr的用法示例。


在下文中一共展示了GpuProgramParametersSharedPtr::setNamedAutoConstant方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

	//---------------------------------------------------------------------
	void TerrainMaterialGeneratorC::SM2Profile::ShaderHelper::defaultFpParams(
		const SM2Profile* prof, const Terrain* terrain, TechniqueType tt, const HighLevelGpuProgramPtr& prog)
	{
		GpuProgramParametersSharedPtr params = prog->getDefaultParameters();
		params->setIgnoreMissingParams(true);
		params->setNamedAutoConstant("fogColour", GpuProgramParameters::ACT_FOG_COLOUR);
		params->setNamedAutoConstant("cFarDistance", Ogre::GpuProgramParameters::ACT_FAR_CLIP_DISTANCE);
		params->setNamedAutoConstant("viewMatrix", GpuProgramParameters::ACT_WORLDVIEW_MATRIX); // tout sauf Z : VIEW_MATRIX
	}
开发者ID:zhouxs1023,项目名称:Editor,代码行数:10,代码来源:TerrainMaterialGeneratorC.cpp

示例2: setUpBaseParameters

    void setUpBaseParameters(const GpuProgramParametersSharedPtr& params)
    {
        assert(params.isNull()==false);

        struct AutoParamPair { String name; GpuProgramParameters::AutoConstantType type; };

        //A list of auto params that might be present in the shaders generated
        static const AutoParamPair AUTO_PARAMS[] = {
            { "vpWidth",            GpuProgramParameters::ACT_VIEWPORT_WIDTH },
            { "vpHeight",           GpuProgramParameters::ACT_VIEWPORT_HEIGHT },
            { "worldView",          GpuProgramParameters::ACT_WORLDVIEW_MATRIX },
            { "invProj",            GpuProgramParameters::ACT_INVERSE_PROJECTION_MATRIX },
            { "invView",            GpuProgramParameters::ACT_INVERSE_VIEW_MATRIX },
            { "flip",               GpuProgramParameters::ACT_RENDER_TARGET_FLIPPING },
            { "lightDiffuseColor",  GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR },
            { "lightSpecularColor", GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR },
            { "lightFalloff",       GpuProgramParameters::ACT_LIGHT_ATTENUATION },
            { "lightPos",           GpuProgramParameters::ACT_LIGHT_POSITION_VIEW_SPACE },
            { "lightDir",           GpuProgramParameters::ACT_LIGHT_DIRECTION_VIEW_SPACE },
            { "spotParams",         GpuProgramParameters::ACT_SPOTLIGHT_PARAMS },
            { "farClipDistance",    GpuProgramParameters::ACT_FAR_CLIP_DISTANCE },
            { "shadowViewProjMat",  GpuProgramParameters::ACT_TEXTURE_VIEWPROJ_MATRIX }
        };
        int numParams = sizeof(AUTO_PARAMS) / sizeof(AutoParamPair);
        
        for (int i=0; i<numParams; i++)
        {
            if (params->_findNamedConstantDefinition(AUTO_PARAMS[i].name))
            {
                params->setNamedAutoConstant(AUTO_PARAMS[i].name, AUTO_PARAMS[i].type);
            }
        }
    }
开发者ID:jakzale,项目名称:ogre,代码行数:33,代码来源:LightMaterialGenerator.cpp

示例3: bindAutoParameters

//-----------------------------------------------------------------------------
void ProgramProcessor::bindAutoParameters(Program* pCpuProgram, GpuProgramPtr pGpuProgram)
{
	GpuProgramParametersSharedPtr pGpuParams = pGpuProgram->getDefaultParameters();
	const UniformParameterList& progParams = pCpuProgram->getParameters();
	UniformParameterConstIterator itParams;

	for (itParams=progParams.begin(); itParams != progParams.end(); ++itParams)
	{
		const UniformParameterPtr pCurParam = *itParams;
		const GpuConstantDefinition* gpuConstDef = pGpuParams->_findNamedConstantDefinition(pCurParam->getName());
	
		if (gpuConstDef != NULL)
		{
			// Handle auto parameters.
			if (pCurParam->isAutoConstantParameter())
			{
				if (pCurParam->isAutoConstantRealParameter())
				{					
					pGpuParams->setNamedAutoConstantReal(pCurParam->getName(), 
						pCurParam->getAutoConstantType(), 
						pCurParam->getAutoConstantRealData());
										
				}
				else if (pCurParam->isAutoConstantIntParameter())
				{					
					pGpuParams->setNamedAutoConstant(pCurParam->getName(), 
						pCurParam->getAutoConstantType(), 
						pCurParam->getAutoConstantIntData());									
				}						
			}

			// Case this is not auto constant - we have to update its variability ourself.
			else
			{							
				gpuConstDef->variability |= pCurParam->getVariability();

				// Update variability in the float map.
				if (gpuConstDef->isSampler() == false)
				{
					GpuLogicalBufferStructPtr floatLogical = pGpuParams->getFloatLogicalBufferStruct();
					if (floatLogical.get())
					{
						for (GpuLogicalIndexUseMap::const_iterator i = floatLogical->map.begin(); i != floatLogical->map.end(); ++i)
						{
							if (i->second.physicalIndex == gpuConstDef->physicalIndex)
							{
								i->second.variability |= gpuConstDef->variability;
								break;
							}
						}
					}
				}											
			}		
		}			
	}
}
开发者ID:changsin,项目名称:ogre,代码行数:57,代码来源:OgreShaderProgramProcessor.cpp

示例4:

	//---------------------------------------------------------------------
	void TerrainMaterialGeneratorA::SM2Profile::ShaderHelper::defaultVpParams(
		const SM2Profile* prof, const Terrain* terrain, TechniqueType tt, const HighLevelGpuProgramPtr& prog)
	{
		GpuProgramParametersSharedPtr params = prog->getDefaultParameters();
		params->setIgnoreMissingParams(true);
		params->setNamedAutoConstant("worldMatrix", GpuProgramParameters::ACT_WORLD_MATRIX);
		params->setNamedAutoConstant("viewProjMatrix", GpuProgramParameters::ACT_VIEWPROJ_MATRIX);
		params->setNamedAutoConstant("lodMorph", GpuProgramParameters::ACT_CUSTOM, 
			Terrain::LOD_MORPH_CUSTOM_PARAM);
		params->setNamedAutoConstant("fogParams", GpuProgramParameters::ACT_FOG_PARAMS);

		if (prof->isShadowingEnabled(tt, terrain))
		{
			uint numTextures = 1;
			if (prof->getReceiveDynamicShadowsPSSM())
			{
				numTextures = (uint)prof->getReceiveDynamicShadowsPSSM()->getSplitCount();
			}
			for (uint i = 0; i < numTextures; ++i)
			{
				params->setNamedAutoConstant("texViewProjMatrix" + StringConverter::toString(i), 
					GpuProgramParameters::ACT_TEXTURE_VIEWPROJ_MATRIX, i);
				if (prof->getReceiveDynamicShadowsDepth())
				{
					params->setNamedAutoConstant("depthRange" + StringConverter::toString(i), 
						GpuProgramParameters::ACT_SHADOW_SCENE_DEPTH_RANGE, i);
				}
			}
		}

		if (terrain->_getUseVertexCompression() && tt != RENDER_COMPOSITE_MAP)
		{
			Matrix4 posIndexToObjectSpace;
			terrain->getPointTransform(&posIndexToObjectSpace);
			params->setNamedConstant("posIndexToObjectSpace", posIndexToObjectSpace);
		}

		
		
	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:41,代码来源:OgreTerrainMaterialGeneratorA.cpp

示例5: String

    //-----------------------------------------------------------------------
    void PagingLandScapeTexture_Splatting5::_loadMaterial()
    {
	    if (mMaterial.isNull() )
	    {
            // Create a new texture using the base image
            const String commonName = StringConverter::toString(mDataZ) + String(".") + StringConverter::toString(mDataX);
            //const String prefilename = PagingLandScapeOptions::getSingleton().landscape_filename;
            //const String postfilename = commonName + "." + PagingLandScapeOptions::getSingleton().TextureExtension;


            String Materialname;
            if (PagingLandScapeOptions::getSingleton().VertexCompression)
            {
                mMaterial = (MaterialManager::getSingleton().getByName("SplattingMaterial5Decompress"));


                GpuProgramParametersSharedPtr params = mMaterial->getTechnique(0)->getPass(0)->getVertexProgramParameters();
	            params->setNamedConstant("splatSettings", Vector4(PagingLandScapeOptions::getSingleton().matHeight[1], 
                                                                    PagingLandScapeOptions::getSingleton().matHeight[2], 
                                                                    PagingLandScapeOptions::getSingleton().maxValue, 
                                                                    0.0));
    //            params->setNamedConstant("compressionSettings", Vector4(PagingLandScapeOptions::getSingleton().scale.x * PagingLandScapeOptions::getSingleton().PageSize, 
    //                                                                PagingLandScapeOptions::getSingleton().scale.y / 65535, 
    //                                                                PagingLandScapeOptions::getSingleton().scale.z * PagingLandScapeOptions::getSingleton().PageSize, 
    //                                                                0.0));
                // Check to see if custom param is already there
                GpuProgramParameters::AutoConstantIterator aci = params->getAutoConstantIterator();
                bool found = false;
                while (aci.hasMoreElements())
                {
                    const GpuProgramParameters::AutoConstantEntry& ace = aci.getNext();
                    if (ace.paramType == GpuProgramParameters::ACT_CUSTOM && 
                        ace.data == MORPH_CUSTOM_PARAM_ID)
                    {
                        found = true;
                    }
                }
                if (!found)
                {                        
                    params->setNamedAutoConstant("compressionSettings", 
                        GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);                       
                }
            }
            else
            {
                mMaterial = MaterialManager::getSingleton().getByName("SplattingMaterial5");


                GpuProgramParametersSharedPtr params = mMaterial->getTechnique(0)->getPass(0)->getVertexProgramParameters();
	            params->setNamedConstant("splatSettings", Vector4(PagingLandScapeOptions::getSingleton().matHeight[1], 
                                                                    PagingLandScapeOptions::getSingleton().matHeight[2], 
                                                                    PagingLandScapeOptions::getSingleton().maxValue, 
                                                                    0.0));
                    
            }

            //  should really be done only once...
    //        GpuProgramParametersSharedPtr params = mMaterial->getTechnique(0)->getPass(0)->getVertexProgramParameters();
    //	    params->setNamedConstant("configSettings", Vector4(PagingLandScapeOptions::getSingleton().matHeight[0], 
    //                                                            PagingLandScapeOptions::getSingleton().matHeight[1], 
    //                                                            PagingLandScapeOptions::getSingleton().maxValue, 
    //                                                            0.0));

            // Now that we have all the resources in place, we load the material
            mMaterial->load(); 
	    }
    }
开发者ID:proton,项目名称:ireon,代码行数:68,代码来源:OgrePagingLandScapeTexture_Splatting5.cpp

示例6: _loadMaterial

//-----------------------------------------------------------------------
void PagingLandScapeTexture_InstantBaseTextureEdit::_loadMaterial()
{
    if (mMaterial.isNull())
    {
        const String filename  = PagingLandScapeOptions::getSingleton().landscape_filename;
        const String extname   = PagingLandScapeOptions::getSingleton().TextureExtension;
        const String groupName = PagingLandScapeOptions::getSingleton().groupName;

        const String commonName = StringConverter::toString(mDataZ) +
                                  String(".") +
                                  StringConverter::toString(mDataX);
        const String matname = String("InstantBaseMaterial.") + commonName + filename;
        const String texname = filename + ".Base." + commonName + ".";

        String finalTexName;
        if (PagingLandScapeOptions::getSingleton().Deformable &&
                ResourceGroupManager::getSingleton().resourceExists(groupName,
                        texname + "modif." +extname))
        {
            finalTexName = texname + "modif." + extname;
        }
        else
        {
            finalTexName = texname + extname;
        }

        if (!mBaseData)
        {
            mImage.load (finalTexName, groupName);
            mBaseData = mImage.getData();
        }

        // check need of material loading
        mMaterial = MaterialManager::getSingleton().getByName(matname);
        if (mMaterial.isNull())
        {
            MaterialPtr templateMaterial;
            if (PagingLandScapeOptions::getSingleton ().VertexCompression)
            {
                templateMaterial = MaterialManager::getSingleton().getByName(String ("InstantBaseMaterialVertexPixelShaded"));

                // Create a new texture using the base image
                mMaterial = templateMaterial->clone(matname, true, groupName);

                GpuProgramParametersSharedPtr params = mMaterial->getTechnique(0)->getPass(0)->getVertexProgramParameters();

//                    params->setNamedConstant("FogSettings", Vector4(PagingLandScapeOptions::getSingleton().scale.x * PagingLandScapeOptions::getSingleton().PageSize,
//                                                                    PagingLandScapeOptions::getSingleton().scale.y / 65535,
//                                                                    PagingLandScapeOptions::getSingleton().scale.z * PagingLandScapeOptions::getSingleton().PageSize,
//                                                                    0.0f));
                // Check to see if custom param is already there
                GpuProgramParameters::AutoConstantIterator aci = params->getAutoConstantIterator();
                bool found = false;
                while (aci.hasMoreElements())
                {
                    const GpuProgramParameters::AutoConstantEntry& ace = aci.getNext();
                    if (ace.paramType == GpuProgramParameters::ACT_CUSTOM &&
                            ace.data == MORPH_CUSTOM_PARAM_ID)
                    {
                        found = true;
                    }
                }
                if (!found)
                {
                    params->setNamedAutoConstant("compressionSettings",
                                                 GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);
                }

            }
            else
            {
                templateMaterial = MaterialManager::getSingleton().getByName(String ("InstantBaseMaterial"));
                // Create a new texture using the base image
                mMaterial = templateMaterial->clone(matname, true, groupName);
            }

            // assign this texture to the material
            _LoadTexture(finalTexName, groupName);
            mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName (finalTexName);

            mMaterial->load();
            mMaterial->setLightingEnabled( PagingLandScapeOptions::getSingleton().lit );
        }
        else
            _LoadTexture(finalTexName, groupName);

    }
}
开发者ID:proton,项目名称:ireon,代码行数:89,代码来源:OgrePagingLandScapeTexture_InstantBaseTextureEdit.cpp

示例7: _updateShaders


//.........这里部分代码省略.........
			vertexShader->setSource(vertexProgSource);

			if (shaderLanguage == "hlsl")
			{
				vertexShader->setParameter("target", "vs_1_1");
				vertexShader->setParameter("entry_point", "main");
			}
			else if(shaderLanguage == "cg")
			{
				vertexShader->setParameter("profiles", "vs_1_1 arbvp1");
				vertexShader->setParameter("entry_point", "main");
			}
			// GLSL can only have one entry point "main".

			vertexShader->load();
		}

		//Now that the shader is ready to be applied, apply it
		StringUtil::StrStreamType materialSignature;
		materialSignature << "BatchMat|";
		materialSignature << ptrMat->getName() << "|";
		if (m_bFadeEnabled)
      {
			materialSignature << m_fVisibleDist << "|";
			materialSignature << m_fInvisibleDist << "|";
		}

		//Search for the desired material
		MaterialPtr generatedMaterial = MaterialManager::getSingleton().getByName(materialSignature.str());
		if (generatedMaterial.isNull())
      {
			//Clone the material
			generatedMaterial = ptrMat->clone(materialSignature.str());

			//And apply the fade shader
			for (unsigned short t = 0; t < generatedMaterial->getNumTechniques(); ++t){
				Technique *tech = generatedMaterial->getTechnique(t);
				for (unsigned short p = 0; p < tech->getNumPasses(); ++p){
					Pass *pass = tech->getPass(p);

					//Setup vertex program
					if (pass->getVertexProgramName() == "")
						pass->setVertexProgram(vertexProgName);

					try{
						GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters();

						if (lightingEnabled) {
							params->setNamedAutoConstant("objSpaceLight", GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE);
							params->setNamedAutoConstant("lightDiffuse", GpuProgramParameters::ACT_DERIVED_LIGHT_DIFFUSE_COLOUR);
							params->setNamedAutoConstant("lightAmbient", GpuProgramParameters::ACT_DERIVED_AMBIENT_LIGHT_COLOUR);
							//params->setNamedAutoConstant("matAmbient", GpuProgramParameters::ACT_SURFACE_AMBIENT_COLOUR);
						}

						params->setNamedConstantFromTime("time", 1);

						if(shaderLanguage.compare("glsl"))
						{
							//glsl can use the built in gl_ModelViewProjectionMatrix
							params->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
						}

						if (m_bFadeEnabled)
                  {
							params->setNamedAutoConstant("camPos", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE);

							//Set fade ranges
							params->setNamedAutoConstant("invisibleDist", GpuProgramParameters::ACT_CUSTOM);
							params->setNamedConstant("invisibleDist", m_fInvisibleDist);

							params->setNamedAutoConstant("fadeGap", GpuProgramParameters::ACT_CUSTOM);
							params->setNamedConstant("fadeGap", m_fInvisibleDist - m_fVisibleDist);

							if (pass->getAlphaRejectFunction() == CMPF_ALWAYS_PASS)
								pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
						}
					}
					catch (const Ogre::Exception &e)
					{
						// test for shader source	
						std::ofstream shaderOutput;
						shaderOutput.open("exception.log");
						shaderOutput << e.getDescription();
						shaderOutput.close();
					}
					catch (...)
               {
						OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
                     "Error configuring batched geometry transitions. If you're using materials with custom\
                     vertex shaders, they will need to implement fade transitions to be compatible with BatchPage.",
                     "BatchPage::_updateShaders()");
					}
				}
			}

		}

		//Apply the material
		subBatch->setMaterial(generatedMaterial);
	}
开发者ID:Kinthes,项目名称:Bullet_Terrain_Paging_test,代码行数:101,代码来源:WindBatchPage.cpp

示例8: updateUniforms

	//-----------------------------------------------------------------------------------
	void PbsMaterial::updateUniforms(const Pass* pass, const AutoParamDataSource* source, const LightList* pLightList)
	{
		// Vertex program
		GpuProgramParametersSharedPtr vertexParams = pass->getVertexProgramParameters();
		vertexParams->setIgnoreMissingParams(true);

		vertexParams->setNamedAutoConstant("mvpMat", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
		vertexParams->setNamedAutoConstant("mvMat", GpuProgramParameters::ACT_WORLDVIEW_MATRIX);

		// Fragment program
		GpuProgramParametersSharedPtr fragmentParams = pass->getFragmentProgramParameters();
		
		fragmentParams->setNamedAutoConstant("ivMat", GpuProgramParameters::ACT_INVERSE_VIEW_MATRIX);
		
		fragmentParams->setNamedConstant("in_albedo", mAlbedo);
		fragmentParams->setNamedConstant("in_f0", mF0);
		fragmentParams->setNamedConstant("in_roughness", mRoughness);
		fragmentParams->setNamedConstant("in_light_roughness_offset", mLightRoughnessOffset);

		fragmentParams->setNamedConstant("in_offset_main", mMainOffset);
		fragmentParams->setNamedConstant("in_scale_main", mMainScale);

		fragmentParams->setNamedConstant("in_offset_d1", mD1Offset);
		fragmentParams->setNamedConstant("in_scale_d1", mD1Scale);

		fragmentParams->setNamedConstant("in_offset_d2", mD2Offset);
		fragmentParams->setNamedConstant("in_scale_d2", mD2Scale);

		// Set light uniforms
		unsigned int count = std::min(mDirectionalLightCount + mPointLightCount + mSpotLightCount, maxLightCount);
		if (count)
		{
			Matrix4 viewMatrix = source->getViewMatrix();
			Quaternion viewMatrixQuat = viewMatrix.extractQuaternion();

			int directionalLightIndex = 0;
			int pointLightLightIndex = 0;
			int spotLightIndex = 0;

			for (unsigned int i = 0; i < count; i++)
			{
				Light* light = (*pLightList)[i];

				int index;
				if (light->getType() == Light::LT_DIRECTIONAL)
				{
					index = directionalLightIndex;
					directionalLightIndex++;
				}
				else if (light->getType() == Light::LT_POINT)
				{
					index = mDirectionalLightCount + pointLightLightIndex;
					pointLightLightIndex++;
				}
				else
				{
					index = mDirectionalLightCount + mPointLightCount + spotLightIndex;
					spotLightIndex++;
				}

				Vector3 pos = viewMatrix * light->getDerivedPosition();
				mLightPositions_es[index * 4 + 0] = pos.x;
				mLightPositions_es[index * 4 + 1] = pos.y;
				mLightPositions_es[index * 4 + 2] = pos.z;

				Vector3 dir = -(viewMatrixQuat * light->getDerivedDirection()).normalisedCopy();
				mLightDirections_es[index * 4 + 0] = dir.x;
				mLightDirections_es[index * 4 + 1] = dir.y;
				mLightDirections_es[index * 4 + 2] = dir.z;

				ColourValue color = light->getDiffuseColour();
				mLightColors[index * 4 + 0] = color.r;
				mLightColors[index* 4 + 1] = color.g;
				mLightColors[index* 4 + 2] = color.b;

				mLightParameters[index * 4 + 0] = light->getAttenuationRange();
				mLightParameters[index * 4 + 1] = Math::Cos(light->getSpotlightOuterAngle() / 2.0);
				mLightParameters[index * 4 + 2] = light->getSpotlightFalloff();
			}

			fragmentParams->setNamedConstant("lightPositions_es", &(mLightPositions_es[0]), count);
			fragmentParams->setNamedConstant("lightDirections_es", &(mLightDirections_es[0]), count);
			fragmentParams->setNamedConstant("lightColors", &(mLightColors[0]), count);
			fragmentParams->setNamedConstant("lightParameters", &(mLightParameters[0]), count);
		}

		// update the textures
		if (_hasSamplerChanged)
		{
			for (int i = 0; i < ST_COUNT; i++)
			{
				SamplerContainer& s = _samplers[i];
				if (s.status == SS_UPDATED)
				{
					updateTexturUnits(s.textureUnitState, fragmentParams, s, i);
					s.status = SS_ACTIVE;
				}
			}

//.........这里部分代码省略.........
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:101,代码来源:OgreHlmsPbsMaterial.cpp

示例9: _updateShaders


//.........这里部分代码省略.........
				}

				vertexProgSource +=
					"   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;  \n"
					"   gl_FogFragCoord = gl_Position.z; \n"
					"}";
			}


			HighLevelGpuProgramPtr vertexShader = HighLevelGpuProgramManager::getSingleton().createProgram(
				vertexProgName,
				ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
				shaderLanguage, GPT_VERTEX_PROGRAM);

			vertexShader->setSource(vertexProgSource);

			if (shaderLanguage == "hlsl")
			{
				vertexShader->setParameter("target", "vs_1_1");
				vertexShader->setParameter("entry_point", "main");
			}
			else if(shaderLanguage == "cg")
			{
				vertexShader->setParameter("profiles", "vs_1_1 arbvp1");
				vertexShader->setParameter("entry_point", "main");
			}
			// GLSL can only have one entry point "main".

			vertexShader->load();
		}

		//Now that the shader is ready to be applied, apply it
		StringUtil::StrStreamType materialSignature;
		materialSignature << "BatchMat|";
		materialSignature << mat->getName() << "|";
		if (fadeEnabled){
			materialSignature << visibleDist << "|";
			materialSignature << invisibleDist << "|";
		}

		//Search for the desired material
		MaterialPtr generatedMaterial = MaterialManager::getSingleton().getByName(materialSignature.str());
		if (generatedMaterial.isNull()){
			//Clone the material
			generatedMaterial = mat->clone(materialSignature.str());

			//And apply the fade shader
			for (unsigned short t = 0; t < generatedMaterial->getNumTechniques(); ++t){
				Technique *tech = generatedMaterial->getTechnique(t);
				for (unsigned short p = 0; p < tech->getNumPasses(); ++p){
					Pass *pass = tech->getPass(p);

					//Setup vertex program
					if (pass->getVertexProgramName() == "")
						pass->setVertexProgram(vertexProgName);

					try{
						GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters();

						if (lightingEnabled) {
							params->setNamedAutoConstant("objSpaceLight", GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE);
							params->setNamedAutoConstant("lightDiffuse", GpuProgramParameters::ACT_DERIVED_LIGHT_DIFFUSE_COLOUR);
							params->setNamedAutoConstant("lightAmbient", GpuProgramParameters::ACT_DERIVED_AMBIENT_LIGHT_COLOUR);
							//params->setNamedAutoConstant("matAmbient", GpuProgramParameters::ACT_SURFACE_AMBIENT_COLOUR);
						}

						if(shaderLanguage.compare("glsl"))
						{
							//glsl can use the built in gl_ModelViewProjectionMatrix
							params->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
						}

						if (fadeEnabled)
						{
							params->setNamedAutoConstant("camPos", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE);

							//Set fade ranges
							params->setNamedAutoConstant("invisibleDist", GpuProgramParameters::ACT_CUSTOM);
							params->setNamedConstant("invisibleDist", invisibleDist);

							params->setNamedAutoConstant("fadeGap", GpuProgramParameters::ACT_CUSTOM);
							params->setNamedConstant("fadeGap", invisibleDist - visibleDist);

							if (pass->getAlphaRejectFunction() == CMPF_ALWAYS_PASS)
								pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
						}
					}
					catch (...) {
						OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, "Error configuring batched geometry transitions. If you're using materials with custom vertex shaders, they will need to implement fade transitions to be compatible with BatchPage.", "BatchPage::_updateShaders()");
					}
				}
			}

		}

		//Apply the material
		subBatch->setMaterial(generatedMaterial);
	}

}
开发者ID:Antaresgames,项目名称:kbengine_ogre_demo,代码行数:101,代码来源:BatchPage.cpp

示例10: getFadeMaterial

//-----------------------------------------------------------------------------
///
MaterialPtr StaticBillboardSet::getFadeMaterial(const Ogre::MaterialPtr &protoMaterial,
                                                Real visibleDist_, Real invisibleDist_)
{
   assert(!protoMaterial.isNull());

   StringUtil::StrStreamType materialSignature;
   materialSignature << mEntityName << "|";
   materialSignature << visibleDist_ << "|";
   materialSignature << invisibleDist_ << "|";
   materialSignature << protoMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getTextureUScroll() << "|";
   materialSignature << protoMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getTextureVScroll() << "|";

   FadedMaterialMap::iterator it = s_mapFadedMaterial.find(materialSignature.str());
   if (it != s_mapFadedMaterial.end())
      return it->second; //Use the existing fade material
   else
   {
      MaterialPtr fadeMaterial = protoMaterial->clone(getUniqueID("ImpostorFade"));

      bool isglsl = Root::getSingleton().getRenderSystem()->getName() == "OpenGL Rendering Subsystem" ? true : false;

      //And apply the fade shader
      for (unsigned short t = 0; t < fadeMaterial->getNumTechniques(); ++t)
      {
         Technique *tech = fadeMaterial->getTechnique(t);
         for (unsigned short p = 0; p < tech->getNumPasses(); ++p)
         {
            Pass *pass = tech->getPass(p);

            //Setup vertex program
            pass->setVertexProgram("SpriteFade_vp");
            GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters();

            //glsl can use the built in gl_ModelViewProjectionMatrix
            if (!isglsl)
               params->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);

            static const Ogre::String uScroll = "uScroll", vScroll = "vScroll",
               preRotatedQuad0 = "preRotatedQuad[0]", preRotatedQuad1 = "preRotatedQuad[1]",
               preRotatedQuad2 = "preRotatedQuad[2]", preRotatedQuad3 = "preRotatedQuad[3]",
               camPos = "camPos", fadeGap = "fadeGap", invisibleDist = "invisibleDist";

            params->setNamedAutoConstant(uScroll, GpuProgramParameters::ACT_CUSTOM);
            params->setNamedAutoConstant(vScroll, GpuProgramParameters::ACT_CUSTOM);
            params->setNamedAutoConstant(preRotatedQuad0, GpuProgramParameters::ACT_CUSTOM);
            params->setNamedAutoConstant(preRotatedQuad1, GpuProgramParameters::ACT_CUSTOM);
            params->setNamedAutoConstant(preRotatedQuad2, GpuProgramParameters::ACT_CUSTOM);
            params->setNamedAutoConstant(preRotatedQuad3, GpuProgramParameters::ACT_CUSTOM);

            params->setNamedAutoConstant(camPos, GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE);
            params->setNamedAutoConstant(fadeGap, GpuProgramParameters::ACT_CUSTOM);
            params->setNamedAutoConstant(invisibleDist, GpuProgramParameters::ACT_CUSTOM);

            //Set fade ranges
            params->setNamedConstant(invisibleDist, invisibleDist_);
            params->setNamedConstant(fadeGap, invisibleDist_ - visibleDist_);

            pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
            //pass->setAlphaRejectFunction(CMPF_ALWAYS_PASS);
            //pass->setDepthWriteEnabled(false);

         }  // for Pass

      }  // for Technique

      //Add it to the list so it can be reused later
      s_mapFadedMaterial.insert(std::pair<String, MaterialPtr>(materialSignature.str(), fadeMaterial));

      return fadeMaterial;
   }
}
开发者ID:drwbns,项目名称:ogre-paged-latest,代码行数:73,代码来源:StaticBillboardSet.cpp

示例11: updateAll

//-----------------------------------------------------------------------------
///
void StaticBillboardSet::updateAll(const Vector3 &cameraDirection)
{
   // s_nSelfInstances will only be greater than 0 if one or more StaticBillboardSet's are using BB_METHOD_ACCELERATED
   if (s_nSelfInstances == 0)
      return;

   //Set shader parameter so material will face camera
   Vector3 forward = cameraDirection;
   Vector3 vRight = forward.crossProduct(Vector3::UNIT_Y);
   Vector3 vUp = forward.crossProduct(vRight);
   vRight.normalise();
   vUp.normalise();

   //Even if camera is upside down, the billboards should remain upright
   if (vUp.y < 0)
      vUp *= -1;

   // Precompute preRotatedQuad for both cases (BBO_CENTER, BBO_BOTTOM_CENTER)
   
   Vector3 vPoint0 = (-vRight + vUp);
   Vector3 vPoint1 = ( vRight + vUp);
   Vector3 vPoint2 = (-vRight - vUp);
   Vector3 vPoint3 = ( vRight - vUp);

   float preRotatedQuad_BBO_CENTER[16] = // single prerotated quad oriented towards the camera
   {
      (float)vPoint0.x, (float)vPoint0.y, (float)vPoint0.z, 0.0f,
      (float)vPoint1.x, (float)vPoint1.y, (float)vPoint1.z, 0.0f,
      (float)vPoint2.x, (float)vPoint2.y, (float)vPoint2.z, 0.0f,
      (float)vPoint3.x, (float)vPoint3.y, (float)vPoint3.z, 0.0f
   };

   vPoint0 = (-vRight + vUp + vUp);
   vPoint1 = ( vRight + vUp + vUp);
   vPoint2 = (-vRight);
   vPoint3 = ( vRight);
   float preRotatedQuad_BBO_BOTTOM_CENTER[16] =
   {
      (float)vPoint0.x, (float)vPoint0.y, (float)vPoint0.z, 0.0f,
      (float)vPoint1.x, (float)vPoint1.y, (float)vPoint1.z, 0.0f,
      (float)vPoint2.x, (float)vPoint2.y, (float)vPoint2.z, 0.0f,
      (float)vPoint3.x, (float)vPoint3.y, (float)vPoint3.z, 0.0f
   };

   // Shaders uniform variables
   static const Ogre::String uScroll = "uScroll", vScroll = "vScroll", preRotatedQuad0 = "preRotatedQuad[0]",
      preRotatedQuad1 = "preRotatedQuad[1]", preRotatedQuad2 = "preRotatedQuad[2]", preRotatedQuad3 = "preRotatedQuad[3]";

   // SVA for Ogre::Material hack
   const GpuConstantDefinition *pGPU_ConstDef_preRotatedQuad0 = 0,
      *pGPU_ConstDef_uScroll = 0, *pGPU_ConstDef_vScroll = 0;

   // For each material in use by the billboard system..
   SBMaterialRefList::iterator i1 = SBMaterialRef::getList().begin(), iend = SBMaterialRef::getList().end();
   while (i1 != iend)
   {
      Ogre::Material *mat = i1->second->getMaterial();

      // Ensure material is set up with the vertex shader
      Pass *p = mat->getTechnique(0)->getPass(0);
      if (!p->hasVertexProgram())
      {
         static const Ogre::String Sprite_vp = "Sprite_vp";
         p->setVertexProgram(Sprite_vp);

         // glsl can use the built in gl_ModelViewProjectionMatrix
         if (!s_isGLSL)
            p->getVertexProgramParameters()->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);

         GpuProgramParametersSharedPtr params = p->getVertexProgramParameters();
         params->setNamedAutoConstant(uScroll, GpuProgramParameters::ACT_CUSTOM);
         params->setNamedAutoConstant(vScroll, GpuProgramParameters::ACT_CUSTOM);
         params->setNamedAutoConstant(preRotatedQuad0, GpuProgramParameters::ACT_CUSTOM);
         params->setNamedAutoConstant(preRotatedQuad1, GpuProgramParameters::ACT_CUSTOM);
         params->setNamedAutoConstant(preRotatedQuad2, GpuProgramParameters::ACT_CUSTOM);
         params->setNamedAutoConstant(preRotatedQuad3, GpuProgramParameters::ACT_CUSTOM);
      }

      // Which prerotated quad use
      const float *pQuad = i1->second->getOrigin() == BBO_CENTER ? preRotatedQuad_BBO_CENTER : preRotatedQuad_BBO_BOTTOM_CENTER;

      // Update the vertex shader parameters
      GpuProgramParametersSharedPtr params = p->getVertexProgramParameters();
      //params->setNamedConstant(preRotatedQuad0, pQuad, 4);
      //params->setNamedConstant(uScroll, p->getTextureUnitState(0)->getTextureUScroll());
      //params->setNamedConstant(vScroll, p->getTextureUnitState(0)->getTextureVScroll());

      // SVA some hack of Ogre::Material.
      // Since material are cloned and use same vertex shader "Sprite_vp" hardware GPU indices
      // must be same. I don`t know planes of Ogre Team to change this behaviour.
      // Therefore this may be unsafe code. Instead of 3 std::map lookups(map::find(const Ogre::String&)) do only 1
      {
         const GpuConstantDefinition *def = params->_findNamedConstantDefinition(preRotatedQuad0, true);
         if (def != pGPU_ConstDef_preRotatedQuad0) // new material, reread
         {
            pGPU_ConstDef_preRotatedQuad0 = def;
            pGPU_ConstDef_uScroll         = params->_findNamedConstantDefinition(uScroll, true);
            pGPU_ConstDef_vScroll         = params->_findNamedConstantDefinition(vScroll, true);
//.........这里部分代码省略.........
开发者ID:drwbns,项目名称:ogre-paged-latest,代码行数:101,代码来源:StaticBillboardSet.cpp

示例12: _loadMaterial

    //-----------------------------------------------------------------------
    void PagingLandScapeTexture_Image::_loadMaterial()
    {
	    if ( mMaterial.isNull() )
	    {
            if (PagingLandScapeOptions::getSingleton().ImageNameLoad)
            {  
                const String filename = PagingLandScapeOptions::getSingleton().image_filename;
                const String commonName = StringConverter::toString(mDataZ) + 
                                            String(".") +
                                            StringConverter::toString(mDataX);
                const String matname = String("ImageTexture.") + commonName + filename;
                mMaterial = MaterialManager::getSingleton().getByName(matname);
                if (mMaterial.isNull())
                {
                    MaterialPtr templateMaterial;
                    if (PagingLandScapeOptions::getSingleton ().VertexCompression)
                    {
                        templateMaterial = MaterialManager::getSingleton().getByName(String ("PagingLandScape.Template.VertexPixelShaded"));
                        mMaterial = templateMaterial->clone(matname);    

                        GpuProgramParametersSharedPtr params = mMaterial->getTechnique(0)->getPass(0)->getVertexProgramParameters();
    	                
    //                    params->setNamedConstant("compressionSettings", Vector4(PagingLandScapeOptions::getSingleton().scale.x * PagingLandScapeOptions::getSingleton().PageSize, 
    //                                                                        PagingLandScapeOptions::getSingleton().scale.y / 65535, 
    //                                                                        PagingLandScapeOptions::getSingleton().scale.z * PagingLandScapeOptions::getSingleton().PageSize, 
    //                                                                        0.0));
                        // Check to see if custom param is already there
                        GpuProgramParameters::AutoConstantIterator aci = params->getAutoConstantIterator();
                        bool found = false;
                        while (aci.hasMoreElements())
                        {
                            const GpuProgramParameters::AutoConstantEntry& ace = aci.getNext();
                            if (ace.paramType == GpuProgramParameters::ACT_CUSTOM && 
                                ace.data == MORPH_CUSTOM_PARAM_ID)
                            {
                                found = true;
                            }
                        }
                        if (!found)
                        {                        
                            params->setNamedAutoConstant("compressionSettings", 
                                GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);                       
                        }
                    }
                    else
                    {
                        templateMaterial = MaterialManager::getSingleton().getByName(String ("PagingLandScape.Template"));
                        mMaterial = templateMaterial->clone(matname);
                    }   
          
                }
                const String texname = filename + "." +
                    commonName + "." + PagingLandScapeOptions::getSingleton().TextureExtension;       
                // assign this texture to the material
                mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(texname);
            }
            else
            {
                // JEFF - all material settings configured through material script
                mMaterial = (MaterialManager::getSingleton().getByName("PagingLandScape." +
                    StringConverter::toString( mDataZ ) + "." + 
                    StringConverter::toString( mDataX )));
            }
               
		    mMaterial->load(); 
            mMaterial->setLightingEnabled( PagingLandScapeOptions::getSingleton().lit );
	    }
    }
开发者ID:proton,项目名称:ireon,代码行数:69,代码来源:OgrePagingLandScapeTexture_Image.cpp

示例13: _updateShaders


//.........这里部分代码省略.........
                  "    { \n";
            } else if (blend) {
              vertexProgSource += "    if (gl_MultiTexCoord0.y != 0.0) \n"
                  "    { \n";
            }

            if (blend) {
              vertexProgSource +=
              //Blend the base of nearby grass into the terrain
                  "        color.w = clamp(color.w, 0.0, 1.0) * 4.0 * ((dist / fadeRange) - 0.1); \n"
                      "    } \n";
            }

            if (fadeTechnique == FADETECH_GROW || fadeTechnique == FADETECH_ALPHAGROW) {
              vertexProgSource += "    position.y -= grassHeight * clamp((2.0 * dist / fadeRange) - 1.0, 0.0, 1.0); \n";
            }

            vertexProgSource += "    gl_Position = gl_ModelViewProjectionMatrix * position; \n"
                "    gl_FrontColor = color; \n"
                "    gl_TexCoord[0] = gl_MultiTexCoord0; \n";
            if (geom->getSceneManager()->getFogMode() == Ogre::FOG_EXP2) {
              vertexProgSource += "	gl_FogFragCoord = clamp(exp(- gl_Fog.density * gl_Fog.density * gl_Position.z * gl_Position.z), 0.0, 1.0); \n";
            } else {
              vertexProgSource += "	gl_FogFragCoord = gl_Position.z; \n";
            }

            vertexProgSource += "}";
          }

          vertexShader = HighLevelGpuProgramManager::getSingleton().createProgram(vsName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, shaderLanguage, GPT_VERTEX_PROGRAM);

          vertexShader->setSource(vertexProgSource);

          if (shaderLanguage == "hlsl") {
            vertexShader->setParameter("target", "vs_1_1");
            vertexShader->setParameter("entry_point", "main");
          } else if (shaderLanguage == "cg") {
            vertexShader->setParameter("profiles", "vs_1_1 arbvp1");
            vertexShader->setParameter("entry_point", "main");
          }
          // GLSL can only have one entry point "main".

          vertexShader->load();
        }
        //Now the vertex shader (vertexShader) has either been found or just generated
        //(depending on whether or not it was already generated).

        tmpMat->load();
        Ogre::Material::TechniqueIterator techIterator = tmpMat->getSupportedTechniqueIterator();
        while (techIterator.hasMoreElements()) {
          Ogre::Technique* tech = techIterator.getNext();
          //Apply the shader to the material
          Pass *pass = tech->getPass(0);
          pass->setVertexProgram(vsName);
          GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters();

          if (shaderLanguage.compare("glsl"))
            //glsl can use the built in gl_ModelViewProjectionMatrix
            params->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
          params->setNamedAutoConstant("camPos", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE);
          params->setNamedAutoConstant("fadeRange", GpuProgramParameters::ACT_CUSTOM, 1);

          if (animate) {
            params->setNamedConstant("time", 1.0f);
            params->setNamedConstant("frequency", 1.0f);
            params->setNamedConstant("direction", Ogre::Vector4::ZERO);
          }

          if (lighting) {
            params->setNamedAutoConstant("objSpaceLight", GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE);
            params->setNamedAutoConstant("lightDiffuse", GpuProgramParameters::ACT_DERIVED_LIGHT_DIFFUSE_COLOUR);
            params->setNamedAutoConstant("lightAmbient", GpuProgramParameters::ACT_DERIVED_AMBIENT_LIGHT_COLOUR);
          }

          if (fadeTechnique == FADETECH_GROW || fadeTechnique == FADETECH_ALPHAGROW) {
            params->setNamedConstant("grassHeight", maxHeight * 1.05f);
          }

          pass->getVertexProgramParameters()->setNamedConstant("fadeRange", fadeRange);
        }
      }
      //Now the material (tmpMat) has either been found or just created (depending on whether or not it was already
      //created). The appropriate vertex shader should be applied and the material is ready for use.

      //Apply the new material
      material = tmpMat;
    }

    Ogre::Technique* tech = material->getBestTechnique();
    if (tech && tech->getNumPasses()) {
      Ogre::Pass* pass = tech->getPass(0);
      if (pass->hasVertexProgram()) {
        Ogre::GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters();
        if (!params.isNull()) {
          params->setIgnoreMissingParams(true);
        }
      }
    }
  }
}
开发者ID:junrw,项目名称:ember-gsoc2012,代码行数:101,代码来源:GrassLoader.cpp

示例14: setupTerrainMaterial


//.........这里部分代码省略.........
                params->setAutoConstant(4, GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);
                // fog exp density(if relevant)
                if (fm == FOG_EXP || fm == FOG_EXP2)
                {
                    params->setConstant(5, Vector3(getFogDensity(), 0, 0));
                    // Override scene fog since otherwise it's applied twice
                    // Set to linear and we derive [0,1] fog value in the shader
                    pass->setFog(true, FOG_LINEAR, getFogColour(), 0, 1, 0);
                }

				// Also set shadow receiver program
				const String& source2 = TerrainVertexProgram::getProgramSource(
					fm, syntax, true);

				prog = GpuProgramManager::getSingleton().createProgramFromString(
					"Terrain/VertexMorphShadowReceive", 
					ResourceGroupManager::getSingleton().getWorldResourceGroupName(), 
					source2, GPT_VERTEX_PROGRAM, syntax);
				pass->setShadowReceiverVertexProgram("Terrain/VertexMorphShadowReceive");
				params = pass->getShadowReceiverVertexProgramParameters();
				// worldviewproj
				params->setAutoConstant(0, GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
				// world
				params->setAutoConstant(4, GpuProgramParameters::ACT_WORLD_MATRIX);
				// texture view / proj
				params->setAutoConstant(8, GpuProgramParameters::ACT_TEXTURE_VIEWPROJ_MATRIX);
				// morph factor
				params->setAutoConstant(12, GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);
				
				if (mDetailTextureName != "")
				{
					pass->getTextureUnitState(1)->setTextureCoordSet(1);
				}


                // Set param index
                mLodMorphParamName = "";
                mLodMorphParamIndex = 4;
            }

            mOptions.terrainMaterial->load();

        }
        else
        {
            // Custom material
            mOptions.terrainMaterial = 
                MaterialManager::getSingleton().getByName(mCustomMaterialName);
			if (mOptions.terrainMaterial.isNull()){
				OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
					"Material " + mCustomMaterialName + " not found.", 
					"TerrainSceneManager::setupTerrainMaterial");
			}
            mOptions.terrainMaterial->load();

        }

        // now set up the linkage between vertex program and LOD morph param
        if (mOptions.lodMorph)
        {
            Technique* t = mOptions.terrainMaterial->getBestTechnique();
            for (ushort i = 0; i < t->getNumPasses(); ++i)
            {
                Pass* p = t->getPass(i);
                if (p->hasVertexProgram())
                {
                    // we have to assume vertex program includes LOD morph capability
                    GpuProgramParametersSharedPtr params = 
                        p->getVertexProgramParameters();
                    // Check to see if custom param is already there
                    GpuProgramParameters::AutoConstantIterator aci = params->getAutoConstantIterator();
                    bool found = false;
                    while (aci.hasMoreElements())
                    {
                        const GpuProgramParameters::AutoConstantEntry& ace = aci.getNext();
                        if (ace.paramType == GpuProgramParameters::ACT_CUSTOM && 
                            ace.data == MORPH_CUSTOM_PARAM_ID)
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        if(mLodMorphParamName != "")
                        {
                            params->setNamedAutoConstant(mLodMorphParamName, 
                                GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);
                        }
                        else
                        {
                            params->setAutoConstant(mLodMorphParamIndex, 
                                GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);
                        }
                    }

                }
            }
        }

    }
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:101,代码来源:OgreTerrainSceneManager.cpp


注:本文中的GpuProgramParametersSharedPtr::setNamedAutoConstant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。