本文整理汇总了C++中ogre::GpuProgramParametersSharedPtr类的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramParametersSharedPtr类的具体用法?C++ GpuProgramParametersSharedPtr怎么用?C++ GpuProgramParametersSharedPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GpuProgramParametersSharedPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyMaterialSetup
//---------------------------------------------------------------------------
void GaussianListener::notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
{
// Prepare the fragment params offsets
switch(pass_id)
{
case 701: // blur horz
{
// horizontal bloom
mat->load();
Ogre::GpuProgramParametersSharedPtr fparams =
mat->getBestTechnique()->getPass(0)->getFragmentProgramParameters();
fparams->setNamedConstant("sampleOffsets", mBloomTexOffsetsHorz[0], 15);
fparams->setNamedConstant("sampleWeights", mBloomTexWeights[0], 15);
break;
}
case 700: // blur vert
{
// vertical bloom
mat->load();
Ogre::GpuProgramParametersSharedPtr fparams =
mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters();
fparams->setNamedConstant("sampleOffsets", mBloomTexOffsetsVert[0], 15);
fparams->setNamedConstant("sampleWeights", mBloomTexWeights[0], 15);
break;
}
}
}
示例2: subEntityAction
//===========================================================================
// MaterialSetShader
//===========================================================================
void MaterialSetShader::subEntityAction( SubEntityMaterial* subEntity ) const
{
Pass * pass = getFirstPassOfFirstTechnique( subEntity ) ;
pass->setLightingEnabled( _light );
if ( "null" != _texture )
{
pass->createTextureUnitState( _texture );
//TextureUnitState *texState = pass->createTextureUnitState( texture ) ;
//texState->setTextureScroll( 0.f, 0.f ) ;
//texState->setColourOperation( Ogre::LBO_MODULATE ) ;
//texState->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
}
if ( "null" != _fragment)
{ //fragment Program
pass->setFragmentProgram( _fragment );
//copy params passed
Ogre::GpuProgramParametersSharedPtr fragmentParams = pass->getFragmentProgramParameters() ;
fragmentParams->copyConstantsFrom( *_fragmentPrm ) ;
}
if ( "null" != _vertex)
{ //vertex Program
pass->setVertexProgram( _vertex );
//copy params passed
Ogre::GpuProgramParametersSharedPtr vertexParams = pass->getVertexProgramParameters() ;
vertexParams->copyConstantsFrom( *_vertexPrm ) ;
}
pass->_load() ;
}
示例3: setChangeWorldFactor
void RenderComponentBillboardSet::setChangeWorldFactor(double factor)
{
Ogre::Technique * technique;
Ogre::GpuProgramParametersSharedPtr params;
Ogre::Pass * pass;
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(mChangeWorldMaterial);
if(material.get())
{
technique= material->getTechnique(0);
if(technique)
{
if(technique->getNumPasses()>0)
{
pass=technique->getPass(0);
if(pass->hasFragmentProgram())
{
params=pass->getFragmentProgramParameters();
if(params.get())
{
params->setNamedConstant("mix_factor",Ogre::Real(factor));
}
}
}
}
}
}
示例4: notifyMaterialRender
void DepthOfFieldListener::notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
{
if(pass_id == 2)
{
float blurScale =.5f;
Ogre::Vector4 pixelSize(1.0f / mViewportWidth, 1.0f / mViewportHeight,1.0f / (mViewportWidth * blurScale), 1.0f / (mViewportHeight * blurScale) );
Ogre::Pass *pass = mat->getBestTechnique()->getPass(0);
Ogre::GpuProgramParametersSharedPtr params = pass->getFragmentProgramParameters();
if (params->_findNamedConstantDefinition("pixelSize"))
params->setNamedConstant("pixelSize", pixelSize);
// this is the camera you're using
#ifndef ROAD_EDITOR
Ogre::Camera *cam = mApp->mSplitMgr->mCameras.front();
#else
Ogre::Camera *cam = mApp->mCamera;
#endif
if (params->_findNamedConstantDefinition("dofparams"))
{
Ogre::Vector4 dofParams(0.0f,mApp->pSet->depthOfFieldFocus,mApp->pSet->depthOfFieldFar,1.0);
params->setNamedConstant("dofparams", dofParams);
}
}
}
示例5: setUpBaseParameters
void setUpBaseParameters(const Ogre::GpuProgramParametersSharedPtr& params)
{
assert(params.isNull()==false);
struct AutoParamPair { Ogre::String name; Ogre::GpuProgramParameters::AutoConstantType type; };
//A list of auto params that might be present in the shaders generated
static const AutoParamPair AUTO_PARAMS[] = {
{ "vpWidth", Ogre::GpuProgramParameters::ACT_VIEWPORT_WIDTH },
{ "vpHeight", Ogre::GpuProgramParameters::ACT_VIEWPORT_HEIGHT },
{ "worldView", Ogre::GpuProgramParameters::ACT_WORLDVIEW_MATRIX },
{ "invProj", Ogre::GpuProgramParameters::ACT_INVERSE_PROJECTION_MATRIX },
{ "invView", Ogre::GpuProgramParameters::ACT_INVERSE_VIEW_MATRIX },
{ "flip", Ogre::GpuProgramParameters::ACT_RENDER_TARGET_FLIPPING },
{ "lightDiffuseColor", Ogre::GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR },
{ "lightSpecularColor", Ogre::GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR },
{ "lightFalloff", Ogre::GpuProgramParameters::ACT_LIGHT_ATTENUATION },
{ "lightPos", Ogre::GpuProgramParameters::ACT_LIGHT_POSITION_VIEW_SPACE },
{ "lightDir", Ogre::GpuProgramParameters::ACT_LIGHT_DIRECTION_VIEW_SPACE },
{ "spotParams", Ogre::GpuProgramParameters::ACT_SPOTLIGHT_PARAMS },
{ "farClipDistance", Ogre::GpuProgramParameters::ACT_FAR_CLIP_DISTANCE },
{ "shadowViewProjMat", Ogre::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);
}
}
}
示例6: setGpuProgramParameter
void GPUManager::setGpuProgramParameter(const GpuProgram &GpuP, const Ogre::String &Name, const int &Value, const bool& UpdateGroundPasses)
{
if (!mSkyX->getMeshManager()->isCreated())
{
return;
}
Ogre::GpuProgramParametersSharedPtr Parameters;
switch (GpuP)
{
case GPUP_VERTEX:
{
Parameters = mSkydomeMaterial->getTechnique(0)->getPass(0)->getVertexProgramParameters();
}
break;
case GPUP_FRAGMENT:
{
Parameters = mSkydomeMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters();
}
break;
}
Parameters->setNamedConstant(Name, Value);
if (!UpdateGroundPasses)
{
return;
}
std::vector<Ogre::Pass*>::iterator PassIt;
for(PassIt = mGroundPasses.begin(); PassIt != mGroundPasses.end(); PassIt++)
{
if (!(*PassIt))
{
mGroundPasses.erase(PassIt);
continue;
}
switch (GpuP)
{
case GPUP_VERTEX:
{
Parameters = (*PassIt)->getVertexProgramParameters();
}
break;
case GPUP_FRAGMENT:
{
Parameters = (*PassIt)->getFragmentProgramParameters();
}
break;
}
Parameters->setNamedConstant(Name, Value);
}
}
示例7: updateSkyFogging
void GroundFog::updateSkyFogging() {
Ogre::GpuProgramParametersSharedPtr params =
mDomeMaterial->getBestTechnique()->getPass(0)->getFragmentProgramParameters();
params->setNamedConstant("fogDensity", getDensity());
params->setNamedConstant("fogColour", getColour());
params->setNamedConstant("fogVerticalDecay", getVerticalDecay());
params->setNamedConstant("fogGroundLevel", getGroundLevel());
}
示例8: setColour
void GroundFog::setColour (const Ogre::ColourValue &colour) {
for (PassSet::iterator it = mPasses.begin(); it != mPasses.end(); ++it) {
Ogre::GpuProgramParametersSharedPtr params = (*it)->getFragmentProgramParameters();
params->setNamedConstant("fogColour", colour);
}
mFogColour = colour;
updateSkyFogging();
}
示例9: notifyCameraChanged
void GroundFog::notifyCameraChanged (Ogre::Camera *cam)
{
CameraBoundElement::notifyCameraChanged (cam);
// Send camera height to shader.
Ogre::GpuProgramParametersSharedPtr params =
mDomeMaterial->getBestTechnique()->getPass(0)->getFragmentProgramParameters();
params->setNamedConstant("cameraHeight", cam->getDerivedPosition().dotProduct(mDomeNode->_getDerivedOrientation() * Ogre::Vector3::UNIT_Y));
}
示例10: forceUpdate
void GroundFog::forceUpdate () {
for (PassSet::iterator it = mPasses.begin(); it != mPasses.end(); ++it) {
Ogre::GpuProgramParametersSharedPtr params = (*it)->getFragmentProgramParameters();
params->setNamedConstant("fogDensity", mDensity);
params->setNamedConstant("fogVerticalDecay", mVerticalDecay);
params->setNamedConstant("fogGroundLevel", mGroundLevel);
params->setNamedConstant("fogColour", mFogColour);
}
updateSkyFogging();
}
示例11: setTextureUnitIndex
void OgrePass::setTextureUnitIndex (int programType, const std::string& name, int index)
{
Ogre::GpuProgramParametersSharedPtr params;
if (programType == GPT_Vertex)
params = mPass->getVertexProgramParameters();
else if (programType == GPT_Fragment)
params = mPass->getFragmentProgramParameters();
params->setNamedConstant(name, index);
}
示例12: setVerticalDecay
void GroundFog::setVerticalDecay (Ogre::Real verticalDecay) {
if (Ogre::Math::Abs(mVerticalDecay - verticalDecay) > 0.000001) {
for (PassSet::iterator it = mPasses.begin(); it != mPasses.end(); ++it) {
Ogre::GpuProgramParametersSharedPtr params = (*it)->getFragmentProgramParameters();
params->setNamedConstant("fogVerticalDecay", verticalDecay);
}
mVerticalDecay = verticalDecay;
}
updateSkyFogging();
}
示例13: setGroundLevel
void GroundFog::setGroundLevel (Ogre::Real groundLevel) {
if (Ogre::Math::Abs(mGroundLevel - groundLevel) > 0.000001) {
for (PassSet::iterator it = mPasses.begin(); it != mPasses.end(); ++it) {
Ogre::GpuProgramParametersSharedPtr params = (*it)->getFragmentProgramParameters();
params->setNamedConstant("fogGroundLevel", groundLevel);
}
mGroundLevel = groundLevel;
}
updateSkyFogging();
}
示例14: addSharedParameter
void OgrePass::addSharedParameter (int type, const std::string& name)
{
Ogre::GpuProgramParametersSharedPtr params;
if (type == GPT_Vertex)
params = mPass->getVertexProgramParameters();
else if (type == GPT_Fragment)
params = mPass->getFragmentProgramParameters();
params->addSharedParameters (name);
}
示例15: setDensity
void GroundFog::setDensity (Ogre::Real density) {
if (Ogre::Math::Abs(mDensity - density) > 0.000001) {
for (PassSet::iterator it = mPasses.begin(); it != mPasses.end(); ++it) {
Ogre::GpuProgramParametersSharedPtr params = (*it)->getFragmentProgramParameters();
params->setNamedConstant("fogDensity", density);
}
mDensity = density;
}
updateSkyFogging();
}