本文整理汇总了C++中Technique类的典型用法代码示例。如果您正苦于以下问题:C++ Technique类的具体用法?C++ Technique怎么用?C++ Technique使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Technique类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lua_Technique_removeParameter
int lua_Technique_removeParameter(lua_State* state)
{
// Get the number of parameters.
int paramCount = lua_gettop(state);
// Attempt to match the parameters to a valid binding.
switch (paramCount)
{
case 2:
{
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
(lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
{
// Get parameter 1 off the stack.
const char* param1 = gameplay::ScriptUtil::getString(2, false);
Technique* instance = getInstance(state);
instance->removeParameter(param1);
return 0;
}
lua_pushstring(state, "lua_Technique_removeParameter - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
default:
{
lua_pushstring(state, "Invalid number of parameters (expected 2).");
lua_error(state);
break;
}
}
return 0;
}
开发者ID:faustgames-ru,项目名称:AndroidWallpapers,代码行数:35,代码来源:lua_Technique.cpp
示例2: while
void MaterialFactory::setShadowsEnabled(bool bEnable)
{
for (std::vector<MaterialDefinition*>::iterator it=mDefinitions.begin();
it!=mDefinitions.end(); ++it)
{
MaterialPtr mat = MaterialManager::getSingleton().getByName( (*it)->getName() );
if (mat.isNull()) continue;
Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Pass* pass = passIt.getNext();
if (pass->hasFragmentProgram())
{
if ( pass->getFragmentProgramParameters()->_findNamedConstantDefinition("enableShadows", false))
pass->getFragmentProgramParameters()->setNamedConstant("enableShadows", Real(bEnable));
}
}
}
}
}
开发者ID:sureandrew,项目名称:stuntrally,代码行数:28,代码来源:MaterialFactory.cpp
示例3: while
void CarModel::ChangeClr()
{
int i = iColor;
float c_h = pSet->gui.car_hue[i], c_s = pSet->gui.car_sat[i],
c_v = pSet->gui.car_val[i], gloss = pSet->gui.car_gloss[i], refl = pSet->gui.car_refl[i];
color.setHSB(1-c_h, c_s, c_v); //set, mini pos clr
MaterialPtr mtr = MaterialManager::getSingleton().getByName(sMtr[Mtr_CarBody]);
if (!mtr.isNull())
{ Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
while (techIt.hasMoreElements())
{ Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{ Pass* pass = passIt.getNext();
if (pass->hasFragmentProgram())
{
GpuProgramParametersSharedPtr params = pass->getFragmentProgramParameters();
params->setNamedConstant("carColour", color);
params->setNamedConstant("glossiness", 1 - gloss);
params->setNamedConstant("reflectiveness", refl);
} } } }
if (pNickTxt)
pNickTxt->setTextColour(MyGUI::Colour(color.r,color.g,color.b));
// opp list text and mini pos colors - auto in hud update
}
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:28,代码来源:CarModel_Update.cpp
示例4: while
void BatchPage::build()
{
batch->build();
BatchedGeometry::SubBatchIterator it = batch->getSubBatchIterator();
while (it.hasMoreElements()){
BatchedGeometry::SubBatch *subBatch = it.getNext();
MaterialPtr mat = subBatch->getMaterial();
//Disable specular unless a custom shader is being used.
//This is done because the default shader applied by BatchPage
//doesn't support specular, and fixed-function needs to look
//the same as the shader (for computers with no shader support)
for (int t = 0; t < mat->getNumTechniques(); ++t){
Technique *tech = mat->getTechnique(t);
for (int p = 0; p < tech->getNumPasses(); ++p){
Pass *pass = tech->getPass(p);
if (pass->getVertexProgramName() == "")
pass->setSpecular(0, 0, 0, 1);
}
}
//Store the original materials
unfadedMaterials.push_back(subBatch->getMaterial());
}
_updateShaders();
}
开发者ID:Chimangoo,项目名称:ember,代码行数:28,代码来源:BatchPage.cpp
示例5: getSafeTextureUnitState
int GameScript::getSafeTextureUnitState(TextureUnitState **tu, const String materialName, int techniqueNum, int passNum, int textureUnitNum)
{
try
{
MaterialPtr m = MaterialManager::getSingleton().getByName(materialName);
if (m.isNull()) return 1;
// verify technique
if (techniqueNum < 0 || techniqueNum > m->getNumTechniques()) return 2;
Technique *t = m->getTechnique(techniqueNum);
if (!t) return 2;
//verify pass
if (passNum < 0 || passNum > t->getNumPasses()) return 3;
Pass *p = t->getPass(passNum);
if (!p) return 3;
//verify texture unit
if (textureUnitNum < 0 || textureUnitNum > p->getNumTextureUnitStates()) return 4;
TextureUnitState *tut = p->getTextureUnitState(textureUnitNum);
if (!tut) return 4;
*tu = tut;
return 0;
} catch(Exception e)
{
SLOG("Exception in getSafeTextureUnitState(): " + e.getFullDescription());
}
return 1;
}
开发者ID:Bob-Z,项目名称:rigs-of-rods,代码行数:30,代码来源:GameScript.cpp
示例6: while
//-----------------------------------------------------------------------------
///
void BatchPage::build()
{
m_pBatchGeom->build();
BatchedGeometry::TSubBatchIterator it = m_pBatchGeom->getSubBatchIterator();
while (it.hasMoreElements())
{
BatchedGeometry::SubBatch *subBatch = it.getNext();
const MaterialPtr &ptrMat = subBatch->getMaterial();
//Disable specular unless a custom shader is being used.
//This is done because the default shader applied by BatchPage
//doesn't support specular, and fixed-function needs to look
//the same as the shader (for computers with no shader support)
for (unsigned short t = 0, tCnt = ptrMat->getNumTechniques(); t < tCnt; ++t)
{
Technique *tech = ptrMat->getTechnique(t);
for (unsigned short p = 0, pCnt = tech->getNumPasses(); p < pCnt; ++p)
{
Pass *pass = tech->getPass(p);
//if (pass->getVertexProgramName() == "")
// pass->setSpecular(0, 0, 0, 1);
if (!pass->hasVertexProgram())
pass->setSpecular(0.f, 0.f, 0.f, 1.f);
}
}
//Store the original materials
m_vecUnfadedMaterials.push_back(subBatch->getMaterial());
}
_updateShaders();
}
开发者ID:drwbns,项目名称:ogre-paged-latest,代码行数:35,代码来源:BatchPage.cpp
示例7: GP_ASSERT
void Model::setMaterialNodeBinding(Material *material)
{
GP_ASSERT(material);
if (_node)
{
material->setNodeBinding(_node);
unsigned int techniqueCount = material->getTechniqueCount();
for (unsigned int i = 0; i < techniqueCount; ++i)
{
Technique* technique = material->getTechniqueByIndex(i);
GP_ASSERT(technique);
technique->setNodeBinding(_node);
unsigned int passCount = technique->getPassCount();
for (unsigned int j = 0; j < passCount; ++j)
{
Pass* pass = technique->getPassByIndex(j);
GP_ASSERT(pass);
pass->setNodeBinding(_node);
}
}
}
}
开发者ID:5guo,项目名称:GamePlay,代码行数:27,代码来源:Model.cpp
示例8: lua_Technique_addRef
static int lua_Technique_addRef(lua_State* state)
{
// Get the number of parameters.
int paramCount = lua_gettop(state);
// Attempt to match the parameters to a valid binding.
switch (paramCount)
{
case 1:
{
if ((lua_type(state, 1) == LUA_TUSERDATA))
{
Technique* instance = getInstance(state);
instance->addRef();
return 0;
}
lua_pushstring(state, "lua_Technique_addRef - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
default:
{
lua_pushstring(state, "Invalid number of parameters (expected 1).");
lua_error(state);
break;
}
}
return 0;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:31,代码来源:lua_Technique.cpp
示例9: lua_Technique_getPassCount
static int lua_Technique_getPassCount(lua_State* state)
{
// Get the number of parameters.
int paramCount = lua_gettop(state);
// Attempt to match the parameters to a valid binding.
switch (paramCount)
{
case 1:
{
if ((lua_type(state, 1) == LUA_TUSERDATA))
{
Technique* instance = getInstance(state);
unsigned int result = instance->getPassCount();
// Push the return value onto the stack.
lua_pushunsigned(state, result);
return 1;
}
lua_pushstring(state, "lua_Technique_getPassCount - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
default:
{
lua_pushstring(state, "Invalid number of parameters (expected 1).");
lua_error(state);
break;
}
}
return 0;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:34,代码来源:lua_Technique.cpp
示例10: Draw
void SpriteShape::Draw(IGraphicsDevice *device, RenderState &state)
{
IGraphicsContext *context = device->GetContext();
Effect *effect = context->GetEffect("Sprite");
if(mHasBackgroundImage) {
effect->SetActiveTechnique("SpriteTexture");
} else {
effect->SetActiveTechnique("SpriteColor");
}
glm::mat4 wvp = state.GetWorldViewProjection();
state.SetShaderData(mWVPIndex, &wvp);
state.SetShaderData(mFrameIndex, &mFrame);
state.SetShaderData(mTextureFrameIndex, &mTexFrame);
state.SetShaderData(mBackgroundColorIndex, &mBackgroundColor);
if(mBackgroundImage) {
state.SetShaderData(mBackgroundImageIndex, mBackgroundImage);
}
state.SetShaderData(mBorderWidthIndex, &mBorderWidth);
state.SetShaderData(mBorderColorIndex, &mBorderColor);
if(sSpriteVertexBuffer) {
Technique *technique = effect->GetActiveTechnique();
technique->Begin();
while(technique->HasNextPass()) {
sSpriteVertexBuffer->Activate();
technique->ProcessNextPass(device, state);
device->Draw(PrimitiveTypeTriangleStrip, 4, 0);
}
}
}
开发者ID:metsfan,项目名称:challenge-engine,代码行数:35,代码来源:SpriteShape.cpp
示例11: getQueueGroup
//-----------------------------------------------------------------------
void RenderQueue::addRenderable(Renderable* pRend, uint8 groupID, ushort priority)
{
// Find group
RenderQueueGroup* pGroup = getQueueGroup(groupID);
Technique* pTech;
// tell material it's been used
if (!pRend->getMaterial().isNull())
pRend->getMaterial()->touch();
// Check material & technique supplied (the former since the default implementation
// of getTechnique is based on it for backwards compatibility
if(pRend->getMaterial().isNull() || !(pTech = pRend->getTechnique()))
{
// Use default base white
MaterialPtr baseWhite = MaterialManager::getSingleton().getByName("BaseWhite");
pTech = baseWhite->getTechnique(0);
}
if (mRenderableListener)
{
// Allow listener to override technique and to abort
if (!mRenderableListener->renderableQueued(pRend, groupID, priority,
&pTech, this))
return; // rejected
// tell material it's been used (incase changed)
pTech->getParent()->touch();
}
pGroup->addRenderable(pRend, pTech, priority);
}
开发者ID:masonh,项目名称:marblemax,代码行数:36,代码来源:OgreRenderQueue.cpp
示例12: materialCreated
void App::materialCreated(sh::MaterialInstance* m, const std::string& configuration, unsigned short lodIndex)
{
Technique* t = static_cast<sh::OgreMaterial*>(m->getMaterial())->getOgreTechniqueForConfiguration (configuration, lodIndex);
if (pSet->shadow_type == Sh_None)
{
t->setShadowCasterMaterial("");
return;
}
/*if (m->hasProperty("transparent") && m->hasProperty("cull_hardware") &&
sh::retrieveValue<sh::StringValue>(m->getProperty("cull_hardware"), 0).get() == "none")
{
// Crash !?
assert(!MaterialManager::getSingleton().getByName("PSSM/shadow_caster_nocull").isNull ());
t->setShadowCasterMaterial("shadowcaster_nocull");
}*/
if (m->hasProperty("instancing") && sh::retrieveValue<sh::StringValue>(m->getProperty("instancing"), 0).get() == "true")
{
t->setShadowCasterMaterial("shadowcaster_instancing");
}
if (!m->hasProperty("transparent") || !sh::retrieveValue<sh::BooleanValue>(m->getProperty("transparent"), 0).get())
{
t->setShadowCasterMaterial("shadowcaster_noalpha");
}
}
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:28,代码来源:CGame.cpp
示例13: visit
void visit(Renderable* rend, ushort lodIndex, bool isDebug,
Any* pAny = 0)
{
Technique* tech = rend->getTechnique();
bool techReceivesShadows = tech && tech->getParent()->getReceiveShadows();
anyReceiveShadows = anyReceiveShadows ||
techReceivesShadows || !tech;
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:8,代码来源:OgreMovableObject.cpp
示例14: ReleaseShaders
void Material::ReleaseShaders()
{
for (unsigned i = 0; i < techniques_.Size(); ++i)
{
Technique* tech = techniques_[i].technique_;
if (tech)
tech->ReleaseShaders();
}
}
开发者ID:SkunkWorks99,项目名称:Urho3D,代码行数:9,代码来源:Material.cpp
示例15: injectTechnique
//-----------------------------------------------------------------------
void DeferredLightRenderOperation::execute(SceneManager *sm, RenderSystem *rs)
{
Ogre::Camera* cam = mViewport->getCamera();
mAmbientLight->updateFromCamera(cam);
Technique* tech = mAmbientLight->getMaterial()->getBestTechnique();
injectTechnique(sm, tech, mAmbientLight, 0);
const LightList& lightList = sm->_getLightsAffectingFrustum();
for (LightList::const_iterator it = lightList.begin(); it != lightList.end(); it++)
{
Light* light = *it;
Ogre::LightList ll;
ll.push_back(light);
//if (++i != 2) continue;
//if (light->getType() != Light::LT_DIRECTIONAL) continue;
//if (light->getDiffuseColour() != ColourValue::Red) continue;
LightsMap::iterator dLightIt = mLights.find(light);
DLight* dLight = 0;
if (dLightIt == mLights.end())
{
dLight = createDLight(light);
}
else
{
dLight = dLightIt->second;
dLight->updateFromParent();
}
dLight->updateFromCamera(cam);
tech = dLight->getMaterial()->getBestTechnique();
//Update shadow texture
if (dLight->getCastChadows())
{
SceneManager::RenderContext* context = sm->_pauseRendering();
sm->prepareShadowTextures(cam, mViewport, &ll);
sm->_resumeRendering(context);
Pass* pass = tech->getPass(0);
TextureUnitState* tus = pass->getTextureUnitState("ShadowMap");
assert(tus);
const TexturePtr& shadowTex = sm->getShadowTexture(0);
if (tus->_getTexturePtr() != shadowTex)
{
tus->_setTexturePtr(shadowTex);
}
}
injectTechnique(sm, tech, dLight, &ll);
}
}
开发者ID:Strongc,项目名称:game-ui-solution,代码行数:56,代码来源:DeferredLightCP.cpp
示例16: setTextureAndTexAniFPS
//--------------------------------------------------------------------------------
static void setTextureAndTexAniFPS(const MaterialPtr& _material, const String& _texture, Real _texAniFPS)
{
Technique* technique = _material->getTechnique(0);
Pass* pass = technique->getPass(0);
if(_texture.empty())
{
pass->removeAllTextureUnitStates();
}
else
{
TextureManager& tmgr = TextureManager::getSingleton();
Ogre::TextureUnitState* tus = pass->getNumTextureUnitStates() ? pass->getTextureUnitState(0) : pass->createTextureUnitState();
if(_texAniFPS == 0)
{
TexturePtr ogreTexture = tmgr.createOrRetrieve(_texture).first;
const String& ogreTexName = ogreTexture->getName();
tus->setTextureName(ogreTexName);
}
else
{
vector<String>::type ogreTexNames;
TexturePtr ogreTexture = tmgr.createOrRetrieve(_texture).first;
ogreTexNames.push_back(ogreTexture->getName());
size_t dotpos = _texture.rfind('.');
if(dotpos != String::npos && dotpos >= 1
&& '0' <= _texture[dotpos-1] && _texture[dotpos-1] < '9')
{
String tmpname = _texture;
char& dig0 = tmpname[dotpos - 1];
++dig0;
while(!tmgr.getByName(tmpname).isNull() || tmgr.canLoadResource(tmpname, TextureManager::GROUP_NAME))
{
TexturePtr ogreTexture = tmgr.createOrRetrieve(tmpname).first;
ogreTexNames.push_back(ogreTexture->getName());
++dig0;
if(dig0 > '9')
{
if(dotpos >= 2 && '0' <= _texture[dotpos-2] && _texture[dotpos-2] < '9')
{
char& dig1 = tmpname[dotpos-2];
++dig1;
dig0 = '0';
}
else
break;
}
}
}
Real duration = ogreTexNames.size() / _texAniFPS;
tus->setAnimatedTextureName(&ogreTexNames[0], ogreTexNames.size(), duration);
}
}
}
开发者ID:raduetsya,项目名称:GothOgre,代码行数:55,代码来源:GothOgre_MaterialUtil.cpp
示例17: CreateInputLayout
void Material::CreateInputLayout(const std::string& technique_name, const std::string& pass_name, D3D11_INPUT_ELEMENT_DESC* input_element_descriptions, UINT input_element_description_count) {
Technique* technique = effect_->TechniquesByName().at(technique_name);
assert(technique != nullptr);
Pass* pass = technique->PassesByName().at(pass_name);
assert(pass != nullptr);
ID3D11InputLayout* input_layout;
pass->CreateInputLayout(input_element_descriptions, input_element_description_count, &input_layout);
input_layout_.insert(std::pair<Pass*, ID3D11InputLayout*>(pass, input_layout));
}
开发者ID:fromdemon,项目名称:dxTest,代码行数:11,代码来源:material.cpp
示例18: injectRender
void LightInstanceBatchHW::injectRender()
{
if( (mRenderOperation.numberOfInstances = updateVertexBuffer( mCurrentCamera )) )
{
Technique* tech = mMaterial->getBestTechnique();
for (size_t i=0; i<tech->getNumPasses(); ++i)
{
mManager->_injectRenderWithPass(tech->getPass(i), this, false);
}
}
}
开发者ID:mavaL,项目名称:MiniCraft,代码行数:12,代码来源:LightInstanceBatchHW.cpp
示例19: setHardwareSkinningParam
//-----------------------------------------------------------------------
bool HardwareSkinning::preAddToRenderState(const RenderState* renderState, Pass* srcPass, Pass* dstPass)
{
bool isValid = true;
Technique* pFirstTech = srcPass->getParent()->getParent()->getTechnique(0);
const Any& hsAny = pFirstTech->getUserObjectBindings().getUserAny(HS_DATA_BIND_NAME);
if (hsAny.isEmpty() == false)
{
HardwareSkinning::SkinningData pData =
(any_cast<HardwareSkinning::SkinningData>(hsAny));
isValid = pData.isValid;
//If the skinning data is being passed through the material, we need to create an instance of the appropriate
//skinning type and set its parameters here
setHardwareSkinningParam(pData.maxBoneCount, pData.maxWeightCount, pData.skinningType,
pData.correctAntipodalityHandling, pData.scalingShearingSupport);
}
//If there is no associated technique, default to linear skinning as a pass-through
if(mActiveTechnique.isNull())
{
setHardwareSkinningParam(0, 0, ST_LINEAR, false, false);
}
int boneCount = mActiveTechnique->getBoneCount();
int weightCount = mActiveTechnique->getWeightCount();
bool doBoneCalculations = isValid &&
(boneCount != 0) && (boneCount <= 256) &&
(weightCount != 0) && (weightCount <= 4) &&
((mCreator == NULL) || (boneCount <= mCreator->getMaxCalculableBoneCount()));
mActiveTechnique->setDoBoneCalculations(doBoneCalculations);
if ((doBoneCalculations) && (mCreator))
{
//update the receiver and caster materials
if (dstPass->getParent()->getShadowCasterMaterial().isNull())
{
dstPass->getParent()->setShadowCasterMaterial(
mCreator->getCustomShadowCasterMaterial(mSkinningType, weightCount - 1));
}
if (dstPass->getParent()->getShadowReceiverMaterial().isNull())
{
dstPass->getParent()->setShadowReceiverMaterial(
mCreator->getCustomShadowReceiverMaterial(mSkinningType, weightCount - 1));
}
}
return true;
}
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:53,代码来源:OgreShaderExHardwareSkinning.cpp
示例20: CreateInputLayout
void Material::CreateInputLayout(const std::string& techniqueName, const std::string& passName, D3D11_INPUT_ELEMENT_DESC* inputElementDescriptions, UINT inputElementDescriptionCount)
{
Technique* technique = mEffect->TechniquesByName().at(techniqueName);
assert(technique != nullptr);
Pass* pass = technique->PassesByName().at(passName);
assert(pass != nullptr);
ID3D11InputLayout* inputLayout;
pass->CreateInputLayout(inputElementDescriptions, inputElementDescriptionCount, &inputLayout);
mInputLayouts.insert(std::pair<Pass*, ID3D11InputLayout*>(pass, inputLayout));
}
开发者ID:cribsb,项目名称:BEngine,代码行数:13,代码来源:Material.cpp
注:本文中的Technique类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论