本文整理汇总了C++中ogre::MaterialPtr::setLightingEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialPtr::setLightingEnabled方法的具体用法?C++ MaterialPtr::setLightingEnabled怎么用?C++ MaterialPtr::setLightingEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MaterialPtr
的用法示例。
在下文中一共展示了MaterialPtr::setLightingEnabled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateRTfixed
// util
//-------------------------------------------------------------------------------------
void BaseApp::CreateRTfixed()
{
if (mShaderGenerator != NULL && mRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION) == false)
{
// creates shaders for base material BaseWhite using the RTSS
Ogre::MaterialPtr baseWhite = Ogre::MaterialManager::getSingleton().getByName("BaseWhite", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhite->setLightingEnabled(false);
mShaderGenerator->createShaderBasedTechnique(
"BaseWhite",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhite");
baseWhite->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhite->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhite->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhite->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
// creates shaders for base material BaseWhiteNoLighting using the RTSS
mShaderGenerator->createShaderBasedTechnique(
"BaseWhiteNoLighting",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhiteNoLighting");
Ogre::MaterialPtr baseWhiteNoLighting = Ogre::MaterialManager::getSingleton().getByName("BaseWhiteNoLighting", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
}
}
示例2: createColorMaterial
void createColorMaterial(const std::string& name, const Ogre::ColourValue& color, bool use_self_illumination)
{
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create( name, ROS_PACKAGE_NAME );
mat->setAmbient(color * 0.5f);
mat->setDiffuse(color);
if( use_self_illumination )
{
mat->setSelfIllumination(color);
}
mat->setLightingEnabled(true);
mat->setReceiveShadows(false);
}
示例3: startDemo
void OgreApp::startDemo(void* uiWindow, void* uiView, unsigned int width, unsigned int height, const char* name)
#endif
{
globals.playerName = name;
new OgreFramework();
#if !defined(OGRE_IS_IOS)
if (!OgreFramework::getSingletonPtr()->initOgre(this, this))
return;
#else
if (!OgreFramework::getSingletonPtr()->initOgre(uiWindow, uiView, width, height))
return;
#endif
m_bShutdown = false;
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Demo initialized!");
#ifdef INCLUDE_RTSHADER_SYSTEM
initialiseRTShaderSystem(OgreFramework::getSingletonPtr()->m_pSceneMgrMain);
Ogre::MaterialPtr baseWhite = Ogre::MaterialManager::getSingleton().getByName("BaseWhite", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhite->setLightingEnabled(false);
mShaderGenerator->createShaderBasedTechnique(
"BaseWhite",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhite");
baseWhite->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhite->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhite->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhite->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
// creates shaders for base material BaseWhiteNoLighting using the RTSS
mShaderGenerator->createShaderBasedTechnique(
"BaseWhiteNoLighting",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhiteNoLighting");
Ogre::MaterialPtr baseWhiteNoLighting = Ogre::MaterialManager::getSingleton().getByName("BaseWhiteNoLighting", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
#endif
setupDemoScene();
#if !((OGRE_PLATFORM == OGRE_PLATFORM_APPLE) && __LP64__)
runDemo();
#endif
}
示例4: mWorld
DebugDrawer::DebugDrawer(Ogre::SceneNode *node, btDynamicsWorld *world) :
mNode(node), mWorld(world), m_debugMode(0)
{
mLineDrawer = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
mLineDrawer->setCastShadows(false); //`
mNode->attachObject(mLineDrawer);
Ogre::ResourceGroupManager::getSingleton().createResourceGroup("BtOgre");
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("BtOgre/DebugLines", "BtOgre");
mat->setReceiveShadows(false);
mat->setLightingEnabled(false);
//mat->setSelfIllumination(1,1,1);
mLineDrawer->setMaterial("BtOgre/DebugLines");/**/ //crash debug..
}
示例5: createDummyScene
void SampleContext::createDummyScene()
{
mWindow->removeAllViewports();
WindEngine::SceneManager* sm = mEngine->createSceneManager(WindEngine::ST_GENERIC, "DummyScene");
WindEngine::Camera* cam = sm->createCamera("DummyCamera");
mWindow->addViewport(cam);
#ifdef USE_RTSHADER_SYSTEM
// Initialize shader generator.
// Must be before resource loading in order to allow parsing extended material attributes.
bool success = initializeRTShaderSystem(sm);
if (!success)
{
OGRE_EXCEPT(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Shader Generator Initialization failed - Core shader libs path not found",
"Sample::_setup");
}
if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION) == false)
{
//newViewport->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
// creates shaders for base material BaseWhite using the RTSS
Ogre::MaterialPtr baseWhite = Ogre::MaterialManager::getSingleton().getByName("BaseWhite", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhite->setLightingEnabled(false);
mShaderGenerator->createShaderBasedTechnique(
"BaseWhite",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhite");
baseWhite->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhite->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhite->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhite->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
// creates shaders for base material BaseWhiteNoLighting using the RTSS
mShaderGenerator->createShaderBasedTechnique(
"BaseWhiteNoLighting",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhiteNoLighting");
Ogre::MaterialPtr baseWhiteNoLighting = Ogre::MaterialManager::getSingleton().getByName("BaseWhiteNoLighting", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
}
#endif // USE_RTSHADER_SYSTEM
}
示例6: createMaterialIfNotExists
std::string createMaterialIfNotExists(const float r, const float g, const float b, const float a)
{
char buf[128];
sprintf(buf, "ShapeColor%f;%f;%f;%f",r,g,b,a);
if(!Ogre::MaterialManager::getSingleton().getByName(buf, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME).isNull())
return buf;
Ogre::ColourValue color( r,g,b,a );
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create( buf, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
mat->setAmbient(color * 0.01f);
mat->setDiffuse(color);
mat->setLightingEnabled(true);
mat->setReceiveShadows(true);
mat->setCullingMode(Ogre::CULL_NONE);
return buf;
}
示例7: startDemo
void DemoApp::startDemo()
{
new OgreFramework();
if(!OgreFramework::getSingletonPtr()->initOgre("DemoApp v1.0", this, 0))
return;
m_bShutdown = false;
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Demo initialized!");
#ifdef USE_RTSHADER_SYSTEM
initializeRTShaderSystem(OgreFramework::getSingletonPtr()->m_pSceneMgr);
Ogre::MaterialPtr baseWhite = Ogre::MaterialManager::getSingleton().getByName("BaseWhite", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhite->setLightingEnabled(false);
mShaderGenerator->createShaderBasedTechnique(
"BaseWhite",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhite");
baseWhite->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhite->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhite->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhite->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
// creates shaders for base material BaseWhiteNoLighting using the RTSS
mShaderGenerator->createShaderBasedTechnique(
"BaseWhiteNoLighting",
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
mShaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
"BaseWhiteNoLighting");
Ogre::MaterialPtr baseWhiteNoLighting = Ogre::MaterialManager::getSingleton().getByName("BaseWhiteNoLighting", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setVertexProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
baseWhiteNoLighting->getTechnique(0)->getPass(0)->setFragmentProgram(
baseWhiteNoLighting->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
#endif
setupDemoScene();
#if !((OGRE_PLATFORM == OGRE_PLATFORM_APPLE) && __LP64__)
runDemo();
#endif
}
示例8:
Ogre::MaterialPtr
IntersectGrid::_createIntersectGridMaterial(void)
{
String name = "IntersectGridMaterial";
Ogre::ResourcePtr res = Ogre::MaterialManager::getSingleton().getByName(name);
if (!res.isNull())
return res;
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->setLightingEnabled(false);
material->setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
material->setDepthWriteEnabled(false);
// Use wireframe polygon mode
material->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME);
return material;
}
示例9: createRTSSMaterial
Ogre::MaterialPtr gkMaterialLoader::createRTSSMaterial(const gkString& matName, bool enableLight)
{
#ifdef OGREKIT_USE_RTSHADER_SYSTEM
Ogre::RTShader::ShaderGenerator* shaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
GK_ASSERT(shaderGenerator);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(matName,
Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
if (material.isNull())
{
material = Ogre::MaterialManager::getSingleton().create(matName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
}
material->setLightingEnabled(enableLight);
shaderGenerator->createShaderBasedTechnique(matName,
Ogre::MaterialManager::DEFAULT_SCHEME_NAME, Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
shaderGenerator->validateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, matName);
if (material->getNumTechniques() > 1)
{
material->getTechnique(0)->getPass(0)->setVertexProgram(
material->getTechnique(1)->getPass(0)->getVertexProgram()->getName());
material->getTechnique(0)->getPass(0)->setFragmentProgram(
material->getTechnique(1)->getPass(0)->getFragmentProgram()->getName());
}
GK_ASSERT(!material->getTechnique(0)->getPass(0)->getVertexProgram().isNull());
GK_ASSERT(!material->getTechnique(0)->getPass(0)->getFragmentProgram().isNull());
return material;
#else
return Ogre::MaterialPtr();
#endif
}
示例10: onInitialize
void ImageSelectionToolCustom::onInitialize()
{
move_tool_->initialize( context_ );
// Create our highlight rectangle
Ogre::SceneManager* scene_manager = context_->getSceneManager();
highlight_node_ = scene_manager->getRootSceneNode()->createChildSceneNode();
std::stringstream ss;
static int count = 0;
ss << "ImageSelectionRect" << count++;
highlight_rectangle_ = new Ogre::Rectangle2D(true);
const static uint32_t texture_data[1] = { 0xffff0070 };
Ogre::DataStreamPtr pixel_stream;
pixel_stream.bind(new Ogre::MemoryDataStream( (void*)&texture_data[0], 4 ));
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().loadRawData(ss.str() + "Texture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, pixel_stream, 1, 1, Ogre::PF_R8G8B8A8, Ogre::TEX_TYPE_2D, 0);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->setLightingEnabled(false);
//material->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME);
highlight_rectangle_->setMaterial(material->getName());
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
highlight_rectangle_->setBoundingBox(aabInf);
highlight_rectangle_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY + 4);
material->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
material->setCullingMode(Ogre::CULL_NONE);
Ogre::TextureUnitState* tex_unit = material->getTechnique(0)->getPass(0)->createTextureUnitState();
tex_unit->setTextureName(tex->getName());
tex_unit->setTextureFiltering( Ogre::TFO_NONE );
highlight_node_->attachObject(highlight_rectangle_);
}
示例11: loadSubMeshMaterial
void gkMaterialLoader::loadSubMeshMaterial(gkSubMesh* mesh, const gkString& group)
{
using namespace Ogre;
gkMaterialProperties& gma = mesh->getMaterial();
if (gma.m_name.empty())
gma.m_name = "<gkBuiltin/DefaultMaterial>";
Ogre::MaterialPtr oma = Ogre::MaterialManager::getSingleton().getByName(gma.m_name.c_str(), group);
if (!oma.isNull())
return;
oma = Ogre::MaterialManager::getSingleton().create(gma.m_name, group);
if (gma.m_mode & gkMaterialProperties::MA_INVISIBLE)
{
// disable writing to this material
oma->setReceiveShadows(false);
oma->setColourWriteEnabled(false);
oma->setDepthWriteEnabled(false);
oma->setDepthCheckEnabled(false);
oma->setLightingEnabled(false);
return;
}
if (gma.m_mode & gkMaterialProperties::MA_TWOSIDE)
{
oma->setCullingMode(Ogre::CULL_NONE);
oma->setManualCullingMode(Ogre::MANUAL_CULL_NONE);
}
// apply lighting params
bool enableLights = (gma.m_mode & gkMaterialProperties::MA_LIGHTINGENABLED) != 0;
oma->setReceiveShadows((gma.m_mode & gkMaterialProperties::MA_RECEIVESHADOWS) != 0);
oma->setLightingEnabled(enableLights);
if (enableLights)
{
gkColor emissive, ambient, specular, diffuse;
emissive = gma.m_diffuse * gma.m_emissive;
ambient = gma.m_diffuse * gma.m_ambient;
specular = gma.m_specular * gma.m_spec;
diffuse = gma.m_diffuse * (gma.m_emissive + gma.m_refraction);
emissive.a = ambient.a = specular.a = 1.f;
oma->setSelfIllumination(emissive);
oma->setAmbient(ambient);
oma->setSpecular(specular);
oma->setDiffuse(diffuse);
oma->setShininess(gma.m_hardness);
}
Ogre::Pass* pass = oma->getTechnique(0)->getPass(0);
bool matBlending = gkEngine::getSingleton().getUserDefs().matblending;
if (matBlending && (gma.m_mode & gkMaterialProperties::MA_HASRAMPBLEND))
{
switch (gma.m_rblend)
{
case GK_BT_MULTIPLY:
pass->setSceneBlending(SBT_MODULATE);
break;
case GK_BT_SUBTRACT:
pass->setSceneBlending(SBF_ONE_MINUS_SOURCE_COLOUR, SBF_ONE);
break;
case GK_BT_DARKEN:
pass->setSceneBlendingOperation(SBO_MIN);
pass->setSceneBlending(SBF_ONE, SBF_ONE);
break;
case GK_BT_LIGHTEN:
pass->setSceneBlendingOperation(SBO_MAX);
pass->setSceneBlending(SBF_ONE, SBF_ONE);
break;
case GK_BT_SCREEN:
pass->setSceneBlending(SBF_ONE_MINUS_DEST_COLOUR, SBF_ONE);
break;
case GK_BT_ADDITIVE:
pass->setSceneBlending(SBT_ADD);
break;
case GK_BT_MIXTURE:
default:
pass->setSceneBlending(SBF_ONE, SBF_ZERO);
break;
}
}
bool hasNormap = false;
bool rtss = gkEngine::getSingleton().getUserDefs().rtss;
for (int i = 0; i < gma.m_totaltex; ++i)
{
gkTextureProperties& gte = gma.m_textures[i];
#ifdef OGREKIT_USE_RTSHADER_SYSTEM
if (gte.m_mode & gkTextureProperties::TM_NORMAL)
{
//.........这里部分代码省略.........