本文整理汇总了C++中ogre::Light类的典型用法代码示例。如果您正苦于以下问题:C++ Light类的具体用法?C++ Light怎么用?C++ Light使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Light类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createScene
//---------------------------------------------------------------------------
void TutorialApplication::createScene()
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(.2f, .2f, .2f));
Ogre::Entity* tudorEntity = mSceneMgr->createEntity("tudorhouse.mesh");
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"Node");
node->attachObject(tudorEntity);
Ogre::Light* light = mSceneMgr->createLight("Light1");
light->setType(Ogre::Light::LT_POINT);
light->setPosition(Ogre::Vector3(250, 150, 250));
light->setDiffuseColour(Ogre::ColourValue::White);
light->setSpecularColour(Ogre::ColourValue::White);
node = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"CamNode1", Ogre::Vector3(1200, -370, 0));
node->yaw(Ogre::Degree(90));
mCamNode = node;
node->attachObject(mCamera);
node = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"CamNode2", Ogre::Vector3(-500, -370, 1000));
node->yaw(Ogre::Degree(-30));
}
示例2: onStart
void DemoState::onStart()
{
//shared_ptr<Grid> grid = make_shared<Grid>(1000.0f, 10.0f);
GameManager::getSingleton().addObject(make_shared<HeadsUpDisplay>());
GameManager::getSingleton().addObject(make_shared<OverheadCameraMan>());
GameManager::getSingleton().addObject(make_shared<Background>());
//GameManager::getSingleton().addObject(grid);
/*
GameManager::getSingleton().addObject(make_shared<Ship>());
GameManager::getSingleton().addObject(make_shared<Ship>());
GameManager::getSingleton().addObject(make_shared<Ship>());
shared_ptr<Planet> planet = make_shared<Planet>();
planet->setPosition(Ogre::Vector3(10, 0, 0));
GameManager::getSingleton().addObject(planet);
*/
shared_ptr<AsteroidField> asteroidField = make_shared<AsteroidField>();
asteroidField->setPosition(Ogre::Vector3(10, 0, 0));
GameManager::getSingleton().addObject(asteroidField);
getScene()->setAmbientLight(Ogre::ColourValue(0.2f, 0.2f, 0.3f));
Ogre::Light* light = getScene()->createLight("MainLight");
light->setPosition(20, 80, 50);
}
示例3: setupScene
void Application::setupScene()
{
mOgreScene = Ogre::Root::getSingleton().createSceneManager("OctreeSceneManager");
mOgreScene->setAmbientLight(Ogre::ColourValue::Black);
mOgreCamera = mOgreScene->createCamera("Camera");
mOgreCamera->setNearClipDistance(0.1f);
mOgreCamera->setFarClipDistance(1000.0f);
Ogre::Viewport* viewport = mOgreWindow->addViewport(mOgreCamera);
mOgreCamera->setAspectRatio(Ogre::Real(viewport->getActualWidth()) / Ogre::Real(viewport->getActualHeight()));
mOgreCamera->setPosition(0, 0, 0);
mOgreFloor = mOgreScene->createEntity("Floor", "plocha.mesh");
mOgreScene->getRootSceneNode()->attachObject(mOgreFloor);
Ogre::Light* light = mOgreScene->createLight("Light");
light->setType(Ogre::Light::LT_POINT);
mOgreChopterNode = mOgreScene->getRootSceneNode()->createChildSceneNode("ChopterNode");
mOgreChopterNode->setPosition(0, 20, 0);
mOgreChopterNode->attachObject(mOgreCamera);
mOgreChopterNode->attachObject(light);
mOgreChopterNode->setFixedYawAxis(true);
}
示例4: enter
void GameState::enter() {
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Entering GameState...");
m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_GENERIC, "GameSceneMgr");
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.4f, 0.4f, 0.4f));
m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
Ogre::Light* dirLight = m_pSceneMgr->createLight("dirLight");
dirLight->setType(Ogre::Light::LT_DIRECTIONAL);
dirLight->setDiffuseColour(Ogre::ColourValue(0.4f, 0.4f, 0.4f));
dirLight->setSpecularColour(Ogre::ColourValue(0.4f, 0.4f, 0.4f));
dirLight->setDirection(Ogre::Vector3(0, -1, 0));
m_pCamera = m_pSceneMgr->createCamera("GameCam");
m_pCamera->setPosition(Vector3(0, 15, -300));
m_pCamera->lookAt(Vector3(0, 15, 0));
m_pCamera->setNearClipDistance(1);
m_pCamera->setAspectRatio(Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualWidth()) / Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualHeight()));
limit = 0.0;
OgreFramework::getSingletonPtr()->m_pViewport->setCamera(m_pCamera);
// create an imageset for the face portrait
CEGUI::ImagesetManager *im = &(CEGUI::ImagesetManager::getSingleton());
CEGUI::NamedXMLResourceManager<CEGUI::Imageset, CEGUI::Imageset_xmlHandler> *castedIm = NULL;
castedIm = (CEGUI::NamedXMLResourceManager<CEGUI::Imageset, CEGUI::Imageset_xmlHandler>*) im;
castedIm->create( "Face.imageset" );
// hide cursor
CEGUI::MouseCursor::getSingleton().hide();
createScene();
}
示例5: rand
Star::Star(int temperature, double radius, Ogre::SceneNode *systemNode, Ogre::SceneManager *sceneMgr, int x, int y) {
kelvin = temperature;
radius = radius;
int rand2 = rand()%1000;
double colorEvener = 0.35;
std::string starNodeName = "Star" + Ogre::StringConverter::toString(temperature) + Ogre::StringConverter::toString(rand2);
std::string starParticleName = "starParticle" + Ogre::StringConverter::toString(temperature) + Ogre::StringConverter::toString(rand2);
std::string starParticleNodeName = "starParticleNode" + Ogre::StringConverter::toString(temperature) + Ogre::StringConverter::toString(rand2);
starNode = systemNode->createChildSceneNode(starNodeName, Ogre::Vector3(0,0,0));
//Particle Gen
Ogre::ParticleSystem* starParticle = sceneMgr->createParticleSystem(starParticleName, "StarWhite");
Ogre::SceneNode* particleNode = systemNode->createChildSceneNode(starParticleNodeName,Ogre::Vector3((-0.5+x),(0+y),0.5));
particleNode->attachObject(starParticle);
setColor(color);
starParticle->getEmitter(0)->setColour(Ogre::ColourValue(color[0]*colorEvener,color[1]*colorEvener,color[2]*colorEvener,color[3]));
//Light Gen
Ogre::SceneNode* lightNode = NULL;
Ogre::Light* lightPoint = sceneMgr->createLight();
lightPoint->setType(Ogre::Light::LT_POINT);
lightPoint->setDiffuseColour(color[0], color[1], color[2]);
lightPoint->setSpecularColour(color[0], color[1], color[2]);
lightNode = systemNode->createChildSceneNode();
lightNode->attachObject(lightPoint);
//Rotation
starRotationDegree = 1.0;
}
示例6:
LUA_DEFINE_FUNCTION(LightsManager, getLightPosition)
{
//
// Pass it to Lua script
//
/* get number of arguments */
int n = lua_gettop(L);
// n should be 1
/* get the first argument (the light name) */
Ogre::String lightName = lua_tostring(L, 1);
//
// Retrieve light position
//
Ogre::Light* light = LightsManager::getSingleton().getLight(lightName);
Vector3 position = light->getPosition();
/* push the X */
lua_pushnumber(L, position.x);
/* push the Y */
lua_pushnumber(L, position.y);
/* push the Z */
lua_pushnumber(L, position.z);
/* return the number of results */
return 3;
}
示例7: enter
void StandLatas::enter() {
_loadingShoot =false;
_timeLoadingShoot =0;
reacomodateCamera();
_numCans=0;
drawCans();
_crosshair = unique_ptr<Crosshair>(new Crosshair(_sceneMgr,_camera));
_crosshair.get()->createCrossHairManual("circle-01.png");
_rayScnQuery =_sceneMgr->createRayQuery(Ogre::Ray(), 0);
_ballStack = _sceneMgr->createSceneNode("ballStack");
_sceneMgr->getRootSceneNode()->addChild(_ballStack);
drawHud();
Carrusel c;
c.go();
_timeWithoutBalls=0;
_puntos=0;
Ogre::Light* light = _sceneMgr->createLight("LightStandLatas");
light->setType(Ogre::Light::LT_DIRECTIONAL);
light->setDirection(Ogre::Vector3(0,0,-1));
light->setPosition(_cameraNode->getPosition());
light->setCastShadows(true);
}
示例8: createScene
//-------------------------------------------------------------------------------------
void GameApplication::createScene() {
// Create your scene here...
//set ambient light
Ogre::Light* light = mSceneMgr->createLight("MainLight");
light->setPosition(15,15,3);
//create the puckManager singleton
PuckManager::instance(mSceneMgr, 10);
//create the shuffleboard singleton
Shuffleboard::instance(mSceneMgr);
//mPuck = PuckManager::instance()->getNextPuck();
/* we should only create a puck when SPACE key is pressed
//This gives us the correct x,y,z position for the puck launch at the top of the shuffleboard
Ogre::Real centreX = ( GameConstants::MAX_X - GameConstants::MIN_X ) / 2 + GameConstants::MIN_X;
Ogre::Vector3 launchPos( centreX, GameConstants::LAUNCH_Y, GameConstants::LAUNCH_Z );
mPuck->activate(launchPos);
mPuck->applyForce(Ogre::Real(7));*/
mGui3D = new Gui3D::Gui3D(&mMyPurplePanelColors);
Ogre::Viewport *viewport = mWindow->getViewport(0);
mGui3D->createScreen(viewport, "purple", "mainScreen");
createGamePanel();
mCurrentTime = 0;
}
示例9: Create
void CEditor::Create( HWND hWnd,int width,int height )
{
GetCurrentDirectory(MAX_PATH, mCurDir);
mpEntityMgr = new CEntityManager;
mpPhysicsMgr = new CPhysicsManager;
Ogre::NameValuePairList parms;
parms["externalWindowHandle"] = Ogre::StringConverter::toString((long)hWnd);
mRenderWindow = mRoot->createRenderWindow("TerrainEditor", width, height, false, &parms);
mhWnd = hWnd;
mSceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC, "MainScene");
// Create the camera
mCamera = mSceneManager->createCamera("PlayerCam");
mCamera->setPosition(mTerrainPos + Ogre::Vector3(200, 400, 0));
mCamera->lookAt(Ogre::Vector3(0, 50, 0));
mCamera->setNearClipDistance(1);
mCamera->setFarClipDistance(12000);
mViewport = mRenderWindow->addViewport(mCamera);
mViewport->setBackgroundColour(Ogre::ColourValue(0.5f,0.5f,0.5f));
//SetupInput();
loadResources();
mGuiMgr = new OgreBites::GuiManager("BrowserControls", mRenderWindow, this);
//mGuiMgr->showBackdrop("SdkTrays/Bands");
mGuiMgr->getTrayContainer(OgreBites::TL_NONE)->hide();
Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_ANISOTROPIC);
Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(7);
mTerrainGlobals = OGRE_NEW Ogre::TerrainGlobalOptions();
Ogre::Light* l = mSceneManager->createLight("terrainLight");
l->setType(Ogre::Light::LT_DIRECTIONAL);
Ogre::Vector3 lightdir(0.1f, -0.3f, 0.1f);
lightdir.normalise();
l->setDirection(lightdir);
l->setDiffuseColour(Ogre::ColourValue::White);
l->setSpecularColour(Ogre::ColourValue(0.4f, 0.4f, 0.4f));
mTerrainLight = l;
mSceneManager->setAmbientLight(Ogre::ColourValue(0.2f, 0.2f, 0.2f));
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
mRoot->addFrameListener(this);
mGuiMgr->showFrameStats(OgreBites::TL_TOPRIGHT);
mpEntityMgr->Create();
mpPhysicsMgr->Create();
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Ogre::Real(mViewport->getActualWidth()) / Ogre::Real(mViewport->getActualHeight()));
SetEditTool(NULL);
}
示例10: getRoot
//--------------------------------------------------------------------------
void
Utility::initComponents()
{
Application::initComponents();
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Ogre::Root *root( getRoot() );
m_scene_manager = root->createSceneManager( Ogre::ST_GENERIC, "Scene" );
m_scene_manager->clearScene();
m_scene_manager->setAmbientLight( Ogre::ColourValue( 0.5, 0.5, 0.5 ) );
Ogre::Light* directionalLight = m_scene_manager->createLight("directionalLight");
directionalLight->setType( Ogre::Light::LT_DIRECTIONAL );
directionalLight->setDiffuseColour( Ogre::ColourValue( 0.5, 0.5, 0.5) );
directionalLight->setSpecularColour( Ogre::ColourValue( 0.5, 0.5, 0.5) );
directionalLight->setDirection( Ogre::Vector3( 0, 0, -1 ) );
m_camera = m_scene_manager->createCamera( "Camera" );
m_camera->setNearClipDistance( 0.01f );
m_camera->setPosition( 0, 5, 10 );
m_camera->lookAt( 0, 0, 0 );
Ogre::RenderWindow *window( getRenderWindow() );
m_viewport = window->addViewport( m_camera );
m_viewport->setBackgroundColour( Ogre::ColourValue( 0.0f, 0.4f, 0.0f ) );
m_camera->setAspectRatio( Ogre::Real( m_viewport->getActualWidth() ) / Ogre::Real( m_viewport->getActualHeight() ) );
m_frame_listener = new DisplayFrameListener( window );
m_frame_listener->setCamera( m_camera );
root->addFrameListener( m_frame_listener );
}
示例11: insertLight
// insert a light related to the most recent insertBegin call.
void InteriorCellRender::insertLight(float r, float g, float b, float radius)
{
assert (insert);
Ogre::Light *light = scene.getMgr()->createLight();
light->setDiffuseColour (r, g, b);
float cval=0.0f, lval=0.0f, qval=0.0f;
if(lightConst)
cval = lightConstValue;
if(!lightOutQuadInLin)
{
if(lightLinear)
radius *= lightLinearRadiusMult;
if(lightQuadratic)
radius *= lightQuadraticRadiusMult;
if(lightLinear)
lval = lightLinearValue / pow(radius, lightLinearMethod);
if(lightQuadratic)
qval = lightQuadraticValue / pow(radius, lightQuadraticMethod);
}
else
{
// FIXME:
// Do quadratic or linear, depending if we're in an exterior or interior
// cell, respectively. Ignore lightLinear and lightQuadratic.
}
light->setAttenuation(10*radius, cval, lval, qval);
insert->attachObject(light);
}
示例12: createScene
//-------------------------------------------------------------------------------------
void HelloOGRE::createScene(void)
{
using namespace Ogre;
Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "7.mesh");
//Ogre::Entity* cube = mSceneMgr->createEntity("cube","abc.mesh");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("Head");
headNode->attachObject(ogreHead);
ManualObject * axis = mSceneMgr->createManualObject("Axis");
axis->begin("line",Ogre::RenderOperation::OperationType::OT_LINE_LIST);
axis->position(0.0f,0.0f,0.0f);
axis->position(20.0f,0.0f,0.0f);
axis->end();
headNode->attachObject(axis);
// Set ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(1.0,0.5, 0.0));
mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
mSceneMgr->setSkyDome(true,"Examples/Rockwall");
//mSceneMgr->setSkyPlane(true,"Example/"
// Create a light
Ogre::Light* l = mSceneMgr->createLight("MainLight");
l->setDiffuseColour(0.0f,1.0f,0.0f);
l->setPosition(20,80,50);
l->setDirection(0.0,0.0,0.0);
}
示例13: createScene
void MyApp::createScene()
{
// Setup shadows.
if (mUseShadows)
{
mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
}
else
{
mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE);
}
// Set the ambient light level.
mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3));
// Create a light source.
Ogre::Light* light = mSceneMgr->createLight("light0");
light->setType(Ogre::Light::LT_POINT);
light->setDiffuseColour(1.0, 1.0, 1.0);
light->setSpecularColour(1.0, 1.0, 1.0);
light->setPosition(100.0, 300.0, 100.0);
// Setup the initial camera position.
mPhysicalCamera->setPosition(opal::Point3r(0, 30, 50));
mPhysicalCamera->lookAt(opal::Point3r(0, 0, 0));
// Load models, create physical objects, etc. here.
}
示例14:
void AWGraphics::SceneDirector::createPlayer()
{
// Add player entity to the scene
Ogre::Entity* ogreEntity = mSceneMgr->createEntity("ogrehead.mesh");
Ogre::SceneNode* parentNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::SceneNode* ogreNode = parentNode->createChildSceneNode();
ogreNode->attachObject(ogreEntity);
ogreNode->rotate(Ogre::Vector3(0.0, 1.0, 0.0), Ogre::Radian(Ogre::Degree(180)));
ogreNode->setPosition(0, 80, 0);
mPlayerNode = parentNode;
// Initialize and add a light
mSceneMgr->setAmbientLight(Ogre::ColourValue(.5, .5, .5));
Ogre::Light* light = mSceneMgr->createLight("MainLight");
light->setType(Ogre::Light::LT_DIRECTIONAL);
light->setDirection(Ogre::Vector3(0, -1, 1));
/*// Directional light
Ogre::Light* directionalLight = mSceneMgr->createLight("DirectionalLight");
directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
directionalLight->setDiffuseColour(Ogre::ColourValue(.8, .6, .2));
directionalLight->setSpecularColour(Ogre::ColourValue(.8, .6, .2));
*/
// Add skydome
mSceneMgr->setSkyDome(true, "CloudySky", 5, 8); // cannot find... :(
}
示例15: createScene
void TutorialApplication::createScene(void)
{
//create primary entity
ent = mSceneMgr->createEntity("foo",inputfile);
//this entity is for testing only
//Ogre::Entity* ent2 = mSceneMgr->createEntity("Ogrehead2","ogrehead.mesh");
//cretae node to which .mesh entity will be attached
node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node1");
node->setPosition(10,0,0);
node->attachObject(ent);
//Ogre::SceneNode* camnode = node->createChildSceneNode("Node2",Ogre::Vector3(80,0,0));
//camnode->attachObject(ent2);
//camnode->attachObject(cam1);
//camnode->attachObject(mCamera);
mSceneMgr->setAmbientLight(Ogre::ColourValue(1,1,1));
Ogre::Light* light = mSceneMgr->createLight("mainlight");
light->setDiffuseColour(Ogre::ColourValue::White);
light->setPosition(10,100,0);
mCamera->setAutoTracking(true, node);
}