From e84d43eb5ec4b2017d02c18621d6aa0b69dea67f Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Sun, 27 Aug 2017 23:13:08 +0200 Subject: [PATCH] Light: deprecate node-less positioning same rationale like for camera. setDirection is only soft-deprected for now due to the inconsistent default direction between SceneNode (0,0,-1) and Light (0, 0, 1). --- OgreMain/include/Ogre.i | 2 + OgreMain/include/OgreLight.h | 12 +++- Samples/AndroidJNI/MainActivity.java | 6 +- Samples/BezierPatch/include/BezierPatch.h | 4 +- Samples/Bootstrap/main.cpp | 4 +- Samples/CameraTrack/include/CameraTrack.h | 4 +- Samples/CelShading/include/CelShading.h | 9 ++- Samples/Character/include/CharacterSample.h | 4 +- Samples/CubeMapping/include/CubeMapping.h | 4 +- Samples/Dot3Bump/include/Dot3Bump.h | 6 +- .../DualQuaternion/include/DualQuaternion.h | 12 ++-- Samples/DynTex/include/DynTex.h | 4 +- .../FacialAnimation/include/FacialAnimation.h | 8 ++- Samples/NewInstancing/src/NewInstancing.cpp | 4 +- .../include/PNTrianglesTessellation.h | 14 ++-- Samples/ParticleFX/include/ParticleFX.h | 4 +- Samples/Python/bites_sample.py | 4 +- Samples/Python/sample.py | 4 +- Samples/SSAO/include/SSAO.h | 2 +- Samples/Shadows/include/Shadows.h | 9 ++- .../include/SkeletalAnimation.h | 23 +++--- Samples/SkyBox/include/SkyBox.h | 4 +- Samples/SkyDome/include/SkyDome.h | 4 +- Samples/SkyPlane/include/SkyPlane.h | 4 +- Samples/Smoke/include/Smoke.h | 4 +- Samples/SphereMapping/include/SphereMapping.h | 4 +- Samples/Transparency/include/Transparency.h | 4 +- Samples/VolumeTex/src/VolumeTex.cpp | 3 +- Samples/Water/include/Water.h | 6 +- .../VisualTests/PlayPen/src/PlayPenTests.cpp | 72 ++++++++++--------- .../VTests/src/StencilShadowTest.cpp | 4 +- .../VTests/src/TransparencyTest.cpp | 4 +- 32 files changed, 152 insertions(+), 104 deletions(-) diff --git a/OgreMain/include/Ogre.i b/OgreMain/include/Ogre.i index b46222db253..2c79bab781e 100644 --- a/OgreMain/include/Ogre.i +++ b/OgreMain/include/Ogre.i @@ -352,6 +352,8 @@ ADD_REPR(ColourValue) %include "OgreShadowCaster.h" %include "OgreMovableObject.h" %include "OgreMovablePlane.h" + %ignore Ogre::Light::setPosition; + %ignore Ogre::Light::getPosition; %include "OgreLight.h" %include "OgreNode.h" %include "OgreBone.h" diff --git a/OgreMain/include/OgreLight.h b/OgreMain/include/OgreLight.h index 87a83f0a283..ce85da19c37 100644 --- a/OgreMain/include/OgreLight.h +++ b/OgreMain/include/OgreLight.h @@ -184,32 +184,38 @@ namespace Ogre { Applicable to point lights and spotlights only. @note This will be overridden if the light is attached to a SceneNode. + @deprecated attach to SceneNode and use SceneNode::setPosition */ - void setPosition(Real x, Real y, Real z); + OGRE_DEPRECATED void setPosition(Real x, Real y, Real z); /// @overload + /// @deprecated attach to SceneNode and use SceneNode::setPosition void setPosition(const Vector3& vec); /** Returns the position of the light. @note Applicable to point lights and spotlights only. + @deprecated attach to SceneNode and use SceneNode::getPosition */ - const Vector3& getPosition(void) const; + OGRE_DEPRECATED const Vector3& getPosition(void) const; /** Sets the direction in which a light points. @remarks Applicable only to the spotlight and directional light types. @note This will be overridden if the light is attached to a SceneNode. + @deprecated only call with (0, 0, -1), then attach to SceneNode and use SceneNode::setDirection */ void setDirection(Real x, Real y, Real z); - //// @overload + /// @overload + /// @deprecated only call with Vector3::NEGATIVE_UNIT_Z, then attach to SceneNode and use SceneNode::setDirection void setDirection(const Vector3& vec); /** Returns the light's direction. @remarks Applicable only to the spotlight and directional light types. + @deprecated attach to SceneNode and use SceneNode::getLocalAxes */ const Vector3& getDirection(void) const; diff --git a/Samples/AndroidJNI/MainActivity.java b/Samples/AndroidJNI/MainActivity.java index f8facc8f2e4..bd869df804b 100644 --- a/Samples/AndroidJNI/MainActivity.java +++ b/Samples/AndroidJNI/MainActivity.java @@ -114,7 +114,9 @@ public void run() { ShaderGenerator.getSingleton().addSceneManager(scnMgr); Light light = scnMgr.createLight("MainLight"); - light.setPosition(0, 10, 15); + SceneNode lightnode = scnMgr.getRootSceneNode().createChildSceneNode(); + lightnode.setPosition(0, 10, 15); + lightnode.attachObject(light); Camera cam = scnMgr.createCamera("myCam"); cam.setNearClipDistance(5); @@ -122,7 +124,7 @@ public void run() { SceneNode camnode = scnMgr.getRootSceneNode().createChildSceneNode(); camnode.attachObject(cam); - camnode.translate(new Vector3(0, 0, 15), Node.TransformSpace.TS_LOCAL); + camnode.setPosition(0, 0, 15); Entity ent = scnMgr.createEntity("Sinbad.mesh"); SceneNode node = scnMgr.getRootSceneNode().createChildSceneNode(); diff --git a/Samples/BezierPatch/include/BezierPatch.h b/Samples/BezierPatch/include/BezierPatch.h index ad164da3d67..5dd877a3b43 100644 --- a/Samples/BezierPatch/include/BezierPatch.h +++ b/Samples/BezierPatch/include/BezierPatch.h @@ -53,7 +53,9 @@ class _OgreSampleClassExport Sample_BezierPatch : public SdkSample { // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); - mSceneMgr->createLight()->setPosition(100, 100, 100); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(100, 100, 100)) + ->attachObject(mSceneMgr->createLight()); // define the control point vertices for our patch PatchVertex verts[9] = diff --git a/Samples/Bootstrap/main.cpp b/Samples/Bootstrap/main.cpp index ccbe1cf02b4..4f0a2c8d5f8 100644 --- a/Samples/Bootstrap/main.cpp +++ b/Samples/Bootstrap/main.cpp @@ -43,7 +43,9 @@ void MyTestApp::setup(void) // without light we would just get a black screen Ogre::Light* light = scnMgr->createLight("MainLight"); - light->setPosition(0, 10, 15); + Ogre::SceneNode* lightNode = scnMgr->getRootSceneNode()->createChildSceneNode(); + lightNode->setPosition(0, 10, 15); + lightNode->attachObject(light); // also need to tell where we are Ogre::SceneNode* camNode = scnMgr->getRootSceneNode()->createChildSceneNode(); diff --git a/Samples/CameraTrack/include/CameraTrack.h b/Samples/CameraTrack/include/CameraTrack.h index 3cb6222728b..8a1f9e948f3 100644 --- a/Samples/CameraTrack/include/CameraTrack.h +++ b/Samples/CameraTrack/include/CameraTrack.h @@ -31,7 +31,9 @@ class _OgreSampleClassExport Sample_CameraTrack : public SdkSample { // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); mSceneMgr->setSkyBox(true, "Examples/MorningSkyBox"); diff --git a/Samples/CelShading/include/CelShading.h b/Samples/CelShading/include/CelShading.h index 52f20935f03..f5b7ea3df6b 100644 --- a/Samples/CelShading/include/CelShading.h +++ b/Samples/CelShading/include/CelShading.h @@ -55,13 +55,12 @@ class _OgreSampleClassExport Sample_CelShading : public SdkSample mCameraMan->setStyle(CS_ORBIT); mTrayMgr->showCursor(); - // create a basic point light with an offset - Light* light = mSceneMgr->createLight(); - light->setPosition(20, 40, 50); - // attach the light to a pivot node mLightPivot = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - mLightPivot->attachObject(light); + + // create a basic point light with an offset + Light* light = mSceneMgr->createLight(); + mLightPivot->createChildSceneNode(Vector3(20, 40, 50))->attachObject(light); // create our model, give it the shader material, and place it at the origin Entity *ent = mSceneMgr->createEntity("Head", "ogrehead.mesh"); diff --git a/Samples/Character/include/CharacterSample.h b/Samples/Character/include/CharacterSample.h index de0f4e6f32f..d5c3f3d1567 100644 --- a/Samples/Character/include/CharacterSample.h +++ b/Samples/Character/include/CharacterSample.h @@ -88,7 +88,9 @@ class _OgreSampleClassExport Sample_Character : public SdkSample // add a bright light above the scene Light* light = mSceneMgr->createLight(); light->setType(Light::LT_POINT); - light->setPosition(-10, 40, 20); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(-10, 40, 20)) + ->attachObject(light); light->setSpecularColour(ColourValue::White); // create a floor mesh resource diff --git a/Samples/CubeMapping/include/CubeMapping.h b/Samples/CubeMapping/include/CubeMapping.h index a380a2f17e4..9ef7f04a0db 100644 --- a/Samples/CubeMapping/include/CubeMapping.h +++ b/Samples/CubeMapping/include/CubeMapping.h @@ -61,7 +61,9 @@ class _OgreSampleClassExport Sample_CubeMapping : public SdkSample, public Rende // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); createCubeMap(); diff --git a/Samples/Dot3Bump/include/Dot3Bump.h b/Samples/Dot3Bump/include/Dot3Bump.h index 44bfdbe4081..6d60a0a2152 100644 --- a/Samples/Dot3Bump/include/Dot3Bump.h +++ b/Samples/Dot3Bump/include/Dot3Bump.h @@ -237,7 +237,7 @@ class _OgreSampleClassExport Sample_Dot3Bump : public SdkSample // create white light l = mSceneMgr->createLight(); - l->setPosition(200, 0, 0); + mLightPivot1->createChildSceneNode(Vector3(200, 0, 0))->attachObject(l); l->setDiffuseColour(1, 1, 1); l->setSpecularColour(1, 1, 1); // create white flare @@ -245,12 +245,11 @@ class _OgreSampleClassExport Sample_Dot3Bump : public SdkSample bbs->setMaterialName("Examples/Flare"); bbs->createBillboard(200, 0, 0)->setColour(ColourValue::White); - mLightPivot1->attachObject(l); mLightPivot1->attachObject(bbs); // create red light l = mSceneMgr->createLight(); - l->setPosition(40, 200, 50); + mLightPivot2->createChildSceneNode(Vector3(50, 200, 50))->attachObject(l); l->setDiffuseColour(1, 0, 0); l->setSpecularColour(1, 0.8, 0.8); // create white flare @@ -258,7 +257,6 @@ class _OgreSampleClassExport Sample_Dot3Bump : public SdkSample bbs->setMaterialName("Examples/Flare"); bbs->createBillboard(50, 200, 50)->setColour(ColourValue::Red); - mLightPivot2->attachObject(l); mLightPivot2->attachObject(bbs); } diff --git a/Samples/DualQuaternion/include/DualQuaternion.h b/Samples/DualQuaternion/include/DualQuaternion.h index c42e052eb50..df03e602a48 100644 --- a/Samples/DualQuaternion/include/DualQuaternion.h +++ b/Samples/DualQuaternion/include/DualQuaternion.h @@ -99,14 +99,14 @@ class _OgreSampleClassExport Sample_DualQuaternion : public SdkSample lightsBbsNode->attachObject(bbs); Light* l = mSceneMgr->createLight(); - Vector3 dir; + Vector3 pos(30, 70, 40); l->setType(Light::LT_POINT); - l->setPosition(30, 70, 40); - dir = -l->getPosition(); - dir.normalise(); - l->setDirection(dir); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(pos) + ->attachObject(l); + l->setDirection(-pos.normalisedCopy()); l->setDiffuseColour(1, 1, 1); - bbs->createBillboard(l->getPosition())->setColour(l->getDiffuseColour()); + bbs->createBillboard(pos)->setColour(l->getDiffuseColour()); // Create a floor mesh resource. MeshManager::getSingleton().createPlane("floor", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, diff --git a/Samples/DynTex/include/DynTex.h b/Samples/DynTex/include/DynTex.h index e53439ad7ff..50a93aa4fec 100644 --- a/Samples/DynTex/include/DynTex.h +++ b/Samples/DynTex/include/DynTex.h @@ -85,7 +85,9 @@ class _OgreSampleClassExport Sample_DynTex : public SdkSample // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); // set initial camera position mCameraMan->setStyle(CS_MANUAL); diff --git a/Samples/FacialAnimation/include/FacialAnimation.h b/Samples/FacialAnimation/include/FacialAnimation.h index 01a08ccf029..79968b495c9 100644 --- a/Samples/FacialAnimation/include/FacialAnimation.h +++ b/Samples/FacialAnimation/include/FacialAnimation.h @@ -48,8 +48,12 @@ class _OgreSampleClassExport Sample_FacialAnimation : public SdkSample { // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); - mSceneMgr->createLight()->setPosition(40, 60, 50); - mSceneMgr->createLight()->setPosition(-120, -80, -50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(40, 60, 50)) + ->attachObject(mSceneMgr->createLight()); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(-120, -80, -50)) + ->attachObject(mSceneMgr->createLight()); // pre-load the mesh so that we can tweak it with a manual animation mHeadMesh = MeshManager::getSingleton().load("facial.mesh", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); diff --git a/Samples/NewInstancing/src/NewInstancing.cpp b/Samples/NewInstancing/src/NewInstancing.cpp index 53148458859..8ac0810d993 100644 --- a/Samples/NewInstancing/src/NewInstancing.cpp +++ b/Samples/NewInstancing/src/NewInstancing.cpp @@ -188,7 +188,7 @@ void Sample_NewInstancing::setupLighting() //Create main (point) light Light* light = mSceneMgr->createLight(); light->setDiffuseColour(lightColour); - light->setPosition( 0.0f, 25.0f, 0.0f ); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3( 0.0f, 25.0f, 0.0f ))->attachObject(light); light->setSpecularColour( 0.6, 0.82, 1.0 ); light->setAttenuation( 3500, 0.085, 0.00008, 0.00006 ); light->setCastShadows( false ); @@ -197,7 +197,7 @@ void Sample_NewInstancing::setupLighting() light = mSceneMgr->createLight(); light->setType( Light::LT_SPOTLIGHT ); light->setDiffuseColour( ColourValue( 0.15f, 0.35f, 0.44f ) ); - light->setPosition( 250.0f, 200.0f, 250.0f ); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3( 250.0f, 200.0f, 250.0f ))->attachObject(light); light->setDirection( (Vector3::UNIT_SCALE * -1.0f).normalisedCopy() ); light->setSpecularColour( 0.2, 0.12, 0.11 ); light->setAttenuation( 3500, 0.005, 0.00002, 0.00001 ); diff --git a/Samples/PNTrianglesTessellation/include/PNTrianglesTessellation.h b/Samples/PNTrianglesTessellation/include/PNTrianglesTessellation.h index 6acc519038b..979de779380 100644 --- a/Samples/PNTrianglesTessellation/include/PNTrianglesTessellation.h +++ b/Samples/PNTrianglesTessellation/include/PNTrianglesTessellation.h @@ -209,8 +209,11 @@ class _OgreSampleClassExport Sample_PNTriangles : public SdkSample l = mSceneMgr->createLight(); l->setDiffuseColour(1.0f, 1.0f, 1.0f); l->setSpecularColour(1.0f, 1.0f, 1.0f); - l->setDirection(Ogre::Vector3::UNIT_X*-1.0f); - l->setPosition(200, 0, 0); + l->setDirection(Vector3::NEGATIVE_UNIT_Z); + SceneNode* ln = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + ln->setPosition(Vector3(200, 0, 0)); + ln->setDirection(-Vector3::UNIT_X); + ln->attachObject(l); // create white flare bbs = mSceneMgr->createBillboardSet(); bbs->setMaterialName("Examples/Flare"); @@ -223,8 +226,11 @@ class _OgreSampleClassExport Sample_PNTriangles : public SdkSample l = mSceneMgr->createLight(); l->setDiffuseColour(1.0f, 0.0f, 0.0f); l->setSpecularColour(1.0f, 0.0f, 0.0f); - l->setDirection(Ogre::Vector3::UNIT_X); - l->setPosition(-200, 0, 0); + l->setDirection(Vector3::NEGATIVE_UNIT_Z); + ln = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + ln->setPosition(Vector3(-200, 0, 0)); + ln->setDirection(Vector3::UNIT_X); + ln->attachObject(l); // create white flare bbs = mSceneMgr->createBillboardSet(); bbs->setMaterialName("Examples/Flare"); diff --git a/Samples/ParticleFX/include/ParticleFX.h b/Samples/ParticleFX/include/ParticleFX.h index 8d9ef0133c8..7a91ab78201 100644 --- a/Samples/ParticleFX/include/ParticleFX.h +++ b/Samples/ParticleFX/include/ParticleFX.h @@ -39,7 +39,9 @@ class _OgreSampleClassExport Sample_ParticleFX : public SdkSample { // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); // set our camera to orbit around the origin and show cursor mCameraMan->setStyle(CS_ORBIT); diff --git a/Samples/Python/bites_sample.py b/Samples/Python/bites_sample.py index 38177c0fd69..459fcef594a 100644 --- a/Samples/Python/bites_sample.py +++ b/Samples/Python/bites_sample.py @@ -54,7 +54,9 @@ def setup(self): scn_mgr.setAmbientLight(Ogre.ColourValue(.1, .1, .1)) light = scn_mgr.createLight("MainLight") - light.setPosition(0, 10, 15) + lightnode = scn_mgr.getRootSceneNode().createChildSceneNode() + lightnode.setPosition(0, 10, 15) + lightnode.attachObject(light) cam = scn_mgr.createCamera("myCam") cam.setNearClipDistance(5) diff --git a/Samples/Python/sample.py b/Samples/Python/sample.py index fcbe81d9214..e6297627c70 100644 --- a/Samples/Python/sample.py +++ b/Samples/Python/sample.py @@ -60,7 +60,9 @@ def main(): scn_mgr.setAmbientLight(Ogre.ColourValue(.1, .1, .1)) light = scn_mgr.createLight("MainLight") - light.setPosition(0, 10, 15) + lightnode = scn_mgr.getRootSceneNode().createChildSceneNode() + lightnode.setPosition(0, 10, 15) + lightnode.attachObject(light) cam = scn_mgr.createCamera("myCam") cam.setPosition(0, 0, 15) diff --git a/Samples/SSAO/include/SSAO.h b/Samples/SSAO/include/SSAO.h index 11d129b5443..5317fe8d777 100644 --- a/Samples/SSAO/include/SSAO.h +++ b/Samples/SSAO/include/SSAO.h @@ -704,7 +704,7 @@ class _OgreSampleClassExport Sample_SSAO : public SdkSample CompositorManager::getSingleton().setCompositorEnabled(mViewport, "SSAO/Post/Modulate", true); mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); mLight = mSceneMgr->createLight(); - mLight->setPosition(30, 80, 30); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(30, 80, 30))->attachObject(mLight); } else { diff --git a/Samples/Shadows/include/Shadows.h b/Samples/Shadows/include/Shadows.h index 8e606e3bc07..fcc4117e255 100644 --- a/Samples/Shadows/include/Shadows.h +++ b/Samples/Shadows/include/Shadows.h @@ -229,12 +229,11 @@ class _OgreSampleClassExport Sample_Shadows : public SdkSample // Fixed light, dim mSunLight = mSceneMgr->createLight("SunLight"); mSunLight->setType(Light::LT_SPOTLIGHT); - mSunLight->setPosition(1500,1750,1300); + + Vector3 pos(1500,1750,1300); + mSceneMgr->getRootSceneNode()->createChildSceneNode(pos)->attachObject(mSunLight); mSunLight->setSpotlightRange(Degree(30), Degree(50)); - Vector3 dir; - dir = -mSunLight->getPosition(); - dir.normalise(); - mSunLight->setDirection(dir); + mSunLight->setDirection(-pos.normalisedCopy()); mSunLight->setDiffuseColour(0.35, 0.35, 0.38); mSunLight->setSpecularColour(0.9, 0.9, 1); diff --git a/Samples/SkeletalAnimation/include/SkeletalAnimation.h b/Samples/SkeletalAnimation/include/SkeletalAnimation.h index 4062e5ffc5f..133617bc600 100644 --- a/Samples/SkeletalAnimation/include/SkeletalAnimation.h +++ b/Samples/SkeletalAnimation/include/SkeletalAnimation.h @@ -197,25 +197,26 @@ class _OgreSampleClassExport Sample_SkeletalAnimation : public SdkSample // add a blue spotlight Light* l = mSceneMgr->createLight(); - Vector3 dir; + Vector3 pos(-40, 180, -10); + SceneNode* ln = mSceneMgr->getRootSceneNode()->createChildSceneNode(pos); + ln->attachObject(l); l->setType(Light::LT_SPOTLIGHT); - l->setPosition(-40, 180, -10); - dir = -l->getPosition(); - dir.normalise(); - l->setDirection(dir); + l->setDirection(Vector3::NEGATIVE_UNIT_Z); + ln->setDirection(-pos); l->setDiffuseColour(0.0, 0.0, 0.5); - bbs->createBillboard(l->getPosition())->setColour(l->getDiffuseColour()); + bbs->createBillboard(pos)->setColour(l->getDiffuseColour()); // add a green spotlight. l = mSceneMgr->createLight(); l->setType(Light::LT_SPOTLIGHT); - l->setPosition(0, 150, -100); - dir = -l->getPosition(); - dir.normalise(); - l->setDirection(dir); + l->setDirection(Vector3::NEGATIVE_UNIT_Z); + pos = Vector3(0, 150, -100); + ln = mSceneMgr->getRootSceneNode()->createChildSceneNode(pos); + ln->attachObject(l); + ln->setDirection(-pos); l->setDiffuseColour(0.0, 0.5, 0.0); - bbs->createBillboard(l->getPosition())->setColour(l->getDiffuseColour()); + bbs->createBillboard(pos)->setColour(l->getDiffuseColour()); // create a floor mesh resource MeshManager::getSingleton().createPlane("floor", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, diff --git a/Samples/SkyBox/include/SkyBox.h b/Samples/SkyBox/include/SkyBox.h index 44f6b409d36..d9108b99b98 100644 --- a/Samples/SkyBox/include/SkyBox.h +++ b/Samples/SkyBox/include/SkyBox.h @@ -25,7 +25,9 @@ class _OgreSampleClassExport Sample_SkyBox : public SdkSample { // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 5000); // set our skybox diff --git a/Samples/SkyDome/include/SkyDome.h b/Samples/SkyDome/include/SkyDome.h index 657cf21d70a..64bc21d25cb 100644 --- a/Samples/SkyDome/include/SkyDome.h +++ b/Samples/SkyDome/include/SkyDome.h @@ -30,7 +30,9 @@ class _OgreSampleClassExport Sample_SkyDome : public SdkSample { // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); // set our camera to orbit around the origin and show cursor mCameraMan->setStyle(CS_ORBIT); diff --git a/Samples/SkyPlane/include/SkyPlane.h b/Samples/SkyPlane/include/SkyPlane.h index 203fec3a381..ed165b965d6 100644 --- a/Samples/SkyPlane/include/SkyPlane.h +++ b/Samples/SkyPlane/include/SkyPlane.h @@ -24,7 +24,9 @@ class _OgreSampleClassExport Sample_SkyPlane : public SdkSample { // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); // create a skyplane 5000 units away, facing down, 10000 square units large, with 3x texture tiling mSceneMgr->setSkyPlane(true, Plane(0, -1, 0, 5000), "Examples/SpaceSkyPlane", 10000, 3); diff --git a/Samples/Smoke/include/Smoke.h b/Samples/Smoke/include/Smoke.h index b8e5f209877..8b0834bec82 100644 --- a/Samples/Smoke/include/Smoke.h +++ b/Samples/Smoke/include/Smoke.h @@ -37,10 +37,10 @@ class _OgreSampleClassExport Sample_Smoke : public SdkSample // dim orange ambient and two bright orange lights to match the skybox mSceneMgr->setAmbientLight(ColourValue(0.3, 0.2, 0)); Light* light = mSceneMgr->createLight(); - light->setPosition(2000, 1000, -1000); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(2000, 1000, -1000))->attachObject(light); light->setDiffuseColour(1, 0.5, 0); light = mSceneMgr->createLight(); - light->setPosition(-2000, 1000, 1000); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-2000, 1000, 1000))->attachObject(light); light->setDiffuseColour(1, 0.5, 0); mPivot = mSceneMgr->getRootSceneNode()->createChildSceneNode(); // create a pivot node diff --git a/Samples/SphereMapping/include/SphereMapping.h b/Samples/SphereMapping/include/SphereMapping.h index aba6a492ba7..dff56b2a100 100644 --- a/Samples/SphereMapping/include/SphereMapping.h +++ b/Samples/SphereMapping/include/SphereMapping.h @@ -31,7 +31,9 @@ class _OgreSampleClassExport Sample_SphereMapping : public SdkSample // setup some basic lighting for our scene mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3)); - mSceneMgr->createLight()->setPosition(20, 80, 50); + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); // set our camera to orbit around the origin and show cursor mCameraMan->setStyle(CS_ORBIT); diff --git a/Samples/Transparency/include/Transparency.h b/Samples/Transparency/include/Transparency.h index 7c560b824e8..9cecc1fc901 100644 --- a/Samples/Transparency/include/Transparency.h +++ b/Samples/Transparency/include/Transparency.h @@ -51,7 +51,9 @@ class _OgreSampleClassExport Sample_Transparency : public SdkSample mCameraNode->setPosition(0, 0, 300); // set camera's starting position - mSceneMgr->createLight()->setPosition(20, 80, 50); // add basic point light + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); // add basic point light // create a torus knot model, give it the translucent texture, and attach it to the origin Entity* ent = mSceneMgr->createEntity("Knot", "knot.mesh"); diff --git a/Samples/VolumeTex/src/VolumeTex.cpp b/Samples/VolumeTex/src/VolumeTex.cpp index a3ab908d4af..6f21b6307ec 100644 --- a/Samples/VolumeTex/src/VolumeTex.cpp +++ b/Samples/VolumeTex/src/VolumeTex.cpp @@ -73,8 +73,7 @@ void Sample_VolumeTex::setupContent() Light* l = mSceneMgr->createLight("MainLight"); l->setDiffuseColour(0.75, 0.75, 0.80); l->setSpecularColour(0.9, 0.9, 1); - l->setPosition(-100,80,50); - mSceneMgr->getRootSceneNode()->attachObject(l); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-100,80,50))->attachObject(l); // Create volume renderable snode = mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0,0,0)); diff --git a/Samples/Water/include/Water.h b/Samples/Water/include/Water.h index 7fd80ee354a..2b8976a25ee 100644 --- a/Samples/Water/include/Water.h +++ b/Samples/Water/include/Water.h @@ -294,11 +294,8 @@ class _OgreSampleClassExport Sample_Water : public SdkSample mSceneMgr->setAmbientLight(ColourValue(0.75, 0.75, 0.75)); // Create a light - Light* l = mSceneMgr->createLight("MainLight"); // Accept default settings: point light, white diffuse, just set position - // NB I could attach the light to a SceneNode if I wanted it to move automatically with - // other objects, but I don't - l->setPosition(200,300,100); + Light* l = mSceneMgr->createLight("MainLight"); // Create water mesh and entity waterMesh = new WaterMesh(MESH_NAME, PLANE_SIZE, COMPLEXITY); @@ -322,6 +319,7 @@ class _OgreSampleClassExport Sample_Water : public SdkSample // Create light node SceneNode* lightNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); + lightNode->setPosition(200,300,100); lightNode->attachObject(l); // set up spline animation of light node diff --git a/Tests/VisualTests/PlayPen/src/PlayPenTests.cpp b/Tests/VisualTests/PlayPen/src/PlayPenTests.cpp index 0336deb68ae..55fdf621354 100644 --- a/Tests/VisualTests/PlayPen/src/PlayPenTests.cpp +++ b/Tests/VisualTests/PlayPen/src/PlayPenTests.cpp @@ -72,11 +72,11 @@ void PlayPen_ManualLOD::setupContent() // Give it a little ambience with lights Light* l; l = mSceneMgr->createLight("BlueLight"); - l->setPosition(-200,-80,-100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-200,-80,-100))->attachObject(l); l->setDiffuseColour(0.5, 0.5, 1.0); l = mSceneMgr->createLight("GreenLight"); - l->setPosition(0,0,-100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0,0,-100))->attachObject(l); l->setDiffuseColour(0.5, 1.0, 0.5); // Position the camera @@ -998,7 +998,7 @@ void PlayPen_SceneNodeTracking::setupContent() // Accept default settings: point light, white diffuse, just set position // NB I could attach the light to a SceneNode if I wanted it to move automatically with // other objects, but I don't - l->setPosition(20,80,50); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(20,80,50))->attachObject(l); Entity *ent; @@ -1100,7 +1100,7 @@ void PlayPen_NonUniqueResourceNames::setupContent() // Accept default settings: point light, white diffuse, just set position // NB I could attach the light to a SceneNode if I wanted it to move automatically with // other objects, but I don't - l->setPosition(20,80,50); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(20,80,50))->attachObject(l); createMeshEntity("Model1", Vector3(10, 10, 10)); createMeshEntity("Model2", Vector3(-10, -10, -10)); @@ -1413,9 +1413,10 @@ void PlayPen_2Spotlights::setupContent() mLight->setType(Light::LT_SPOTLIGHT); mLight->setDiffuseColour(1.0, 0.0, 0.8); mLight->setSpotlightRange(Degree(30), Degree(40)); + mLight->setDirection(Vector3::NEGATIVE_UNIT_Z); mTestNode[0] = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mTestNode[0]->setPosition(800,600,0); - mTestNode[0]->lookAt(Vector3(800,0,0), Node::TS_WORLD, Vector3::UNIT_Z); + mTestNode[0]->lookAt(Vector3(800,0,0), Node::TS_WORLD); mTestNode[0]->attachObject(mLight); mTestNode[1] = mSceneMgr->getRootSceneNode()->createChildSceneNode(); @@ -1424,9 +1425,10 @@ void PlayPen_2Spotlights::setupContent() mLight->setType(Light::LT_SPOTLIGHT); mLight->setDiffuseColour(0, 1.0, 0.8); mLight->setSpotlightRange(Degree(30), Degree(40)); + mLight->setDirection(Vector3::NEGATIVE_UNIT_Z); mTestNode[1] = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mTestNode[1]->setPosition(0,600,800); - mTestNode[1]->lookAt(Vector3(0,0,800), Node::TS_WORLD, Vector3::UNIT_Z); + mTestNode[1]->lookAt(Vector3(0,0,800), Node::TS_WORLD); mTestNode[1]->attachObject(mLight); Plane plane( Vector3::UNIT_Y, -100); @@ -1626,11 +1628,11 @@ void PlayPen_AttachObjectsToBones::setupContent() // Give it a little ambience with lights Light* l; l = mSceneMgr->createLight("BlueLight"); - l->setPosition(-200,-80,-100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-200,-80,-100))->attachObject(l); l->setDiffuseColour(0.5, 0.5, 1.0); l = mSceneMgr->createLight("GreenLight"); - l->setPosition(0,0,-100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0,0,-100))->attachObject(l); l->setDiffuseColour(0.5, 1.0, 0.5); // Position the camera @@ -2106,7 +2108,7 @@ void PlayPen_BuildTangentOnAnimatedMesh::setupContent() /*/ // Point test mLight->setType(Light::LT_POINT); - mLight->setPosition(0, 200, 0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0, 200, 0))->attachObject(mLight); //*/ MeshPtr pMesh = MeshManager::getSingleton().load("ninja.mesh", ASSETS_RESOURCE_GROUP/*, HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, @@ -2315,9 +2317,10 @@ void PlayPen_CompositorTextureShadows::setupContent() // Spotlight test mLight->setType(Light::LT_SPOTLIGHT); mLight->setDiffuseColour(1.0, 1.0, 0.8); + mLight->setDirection(Vector3::NEGATIVE_UNIT_Z); mTestNode[0] = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mTestNode[0]->setPosition(800,600,0); - mTestNode[0]->lookAt(Vector3(0,0,0), Node::TS_WORLD, Vector3::UNIT_Z); + mTestNode[0]->lookAt(Vector3(0,0,0), Node::TS_WORLD); mTestNode[0]->attachObject(mLight); @@ -2539,11 +2542,10 @@ void PlayPen_DepthShadowMap::setupContent() // Single light Light* l = mSceneMgr->createLight("l1"); l->setType(Light::LT_SPOTLIGHT); - //l->setPosition(500, 500, -100); - l->setPosition(0, 300, 0); - Vector3 dir = -l->getPosition(); - dir.normalise(); - l->setDirection(dir); + //mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(500, 500, -100))->attachObject(l); + Vector3 pos(0, 300, 0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(pos)->attachObject(l); + l->setDirection(-pos.normalisedCopy()); l->setSpotlightOuterAngle(Degree(40)); l->setSpotlightInnerAngle(Degree(35)); @@ -2957,10 +2959,11 @@ void PlayPen_FarFromOrigin::setupContent() mLight->setType(Light::LT_SPOTLIGHT); mLight->setAttenuation(10000, 1, 0, 0); mLight->setDiffuseColour(1.0, 1.0, 0.5); + mLight->setDirection(Vector3::NEGATIVE_UNIT_Z); mTestNode[0] = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mTestNode[0]->setPosition(offset + Vector3(-400,300,1000)); - mTestNode[0]->lookAt(offset, Node::TS_WORLD, Vector3::UNIT_Z); + mTestNode[0]->lookAt(offset, Node::TS_WORLD); mTestNode[0]->attachObject(mLight); @@ -3839,13 +3842,13 @@ void PlayPen_ManualIlluminationStage::setupContent() mSceneMgr->setAmbientLight(ColourValue(0.0, 0.0, 0.0)); Light* mLight = mSceneMgr->createLight("MainLight"); - mLight->setPosition(-400,400,-300); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-400,400,-300))->attachObject(mLight); mLight->setDiffuseColour(0.9, 0.9, 1); mLight->setSpecularColour(0.9, 0.9, 1); mLight->setAttenuation(6000,1,0.001,0); mLight = mSceneMgr->createLight("Light2"); - mLight->setPosition(300,200,100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(300,200,100))->attachObject(mLight); mLight->setDiffuseColour(1, 0.6, 0.5); mLight->setSpecularColour(0.9, 0.9, 1); mLight->setAttenuation(6000,1,0.001,0); @@ -4645,7 +4648,7 @@ void PlayPen_MultiSceneManagersSimple::setupContent() // Create a secondary scene manager with it's own camera SceneManager* sm2 = Root::getSingleton().createSceneManager(ST_GENERIC); Light* l = sm2->createLight("l2"); - l->setPosition(100, 50, -100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(100, 50, -100))->attachObject(l); l->setDiffuseColour(ColourValue::Green); // l->setDiffuseColour(ColourValue::Red); sm2->setAmbientLight(ColourValue(0.2, 0.2, 0.2)); @@ -4665,7 +4668,7 @@ void PlayPen_MultiSceneManagersSimple::setupContent() // Use original SM for normal scene l = mSceneMgr->createLight("l"); // note same name, will work since different SM - l->setPosition(100, 50, -100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(100, 50, -100))->attachObject(l); l->setDiffuseColour(ColourValue::Red); mSceneMgr->setAmbientLight(ColourValue(0.2, 0.2, 0.2)); ent = mSceneMgr->createEntity("head", "ogrehead.mesh"); @@ -4733,7 +4736,7 @@ void PlayPen_NegativeScale::setupContent() { mSceneMgr->setAmbientLight(ColourValue(0.2, 0.2, 0.2)); Light* l = mSceneMgr->createLight("l1"); - l->setPosition(500, 500, 200); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(500, 500, 200))->attachObject(l); l->setDiffuseColour(ColourValue::White); //mSceneMgr->setFlipCullingOnNegativeScale(false); @@ -4793,7 +4796,7 @@ void PlayPen_NormalMapMirroredUVs::setupContent() mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(e); Light* l = mSceneMgr->createLight("3"); - l->setPosition(1000,500,1000); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(1000,500,1000))->attachObject(l); mCameraNode->setPosition(0,200,50); mCameraNode->lookAt(Vector3::ZERO, Node::TS_PARENT); @@ -4820,7 +4823,7 @@ void PlayPen_Ortho::setupContent() // Create a point light Light* l = mSceneMgr->createLight("MainLight"); - l->setPosition(800,600,0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(800,600,0))->attachObject(l); mTestNode[0] = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mSceneMgr->getRootSceneNode()->createChildSceneNode(); @@ -5193,7 +5196,7 @@ void PlayPen_ReinitialiseEntityAlteredMesh::setupContent() mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); Light* l = mSceneMgr->createLight("l1"); - l->setPosition(200, 300, 0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(200, 300, 0))->attachObject(l); Ogre::MeshManager::getSingleton().load("knot.mesh", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)->clone("knot_REINIT.mesh"); @@ -5507,9 +5510,10 @@ void PlayPen_ShadowLod::setupContent() mLight->setType(Light::LT_SPOTLIGHT); mLight->setAttenuation(10000, 1, 0, 0); mLight->setDiffuseColour(1.0, 1.0, 0.8); + mLight->setDirection(Vector3::NEGATIVE_UNIT_Z); mTestNode[0] = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mTestNode[0]->setPosition(400,300,0); - mTestNode[0]->lookAt(Vector3(0,0,0), Node::TS_WORLD, Vector3::UNIT_Z); + mTestNode[0]->lookAt(Vector3(0,0,0), Node::TS_WORLD); mTestNode[0]->attachObject(mLight); } @@ -5622,11 +5626,11 @@ void PlayPen_SkeletalAnimation::setupContent() // Give it a little ambience with lights Light* l; l = mSceneMgr->createLight("BlueLight"); - l->setPosition(-200,-80,-100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-200,-80,-100))->attachObject(l); l->setDiffuseColour(0.5, 0.5, 1.0); l = mSceneMgr->createLight("GreenLight"); - l->setPosition(0,0,-100); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0,0,-100))->attachObject(l); l->setDiffuseColour(0.5, 1.0, 0.5); // Position the camera @@ -5682,7 +5686,7 @@ void PlayPen_SkeletonAnimationOptimise::setupContent() /*/ // Point test mLight->setType(Light::LT_POINT); - mLight->setPosition(0, 200, 0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0, 200, 0))->attachObject(mLight); //*/ Entity* pEnt; @@ -5910,7 +5914,7 @@ void PlayPen_StaticGeometry::setupContent() kf->setTranslate(Vector3(2300, 600, 2300)); //animNode->attachObject(l); - l->setPosition(0, 600, 0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0, 600, 0))->attachObject(l); l->setAttenuation(10000, 1, 0, 0); AnimationState* animState = mSceneMgr->createAnimationState("an1"); @@ -6011,7 +6015,7 @@ void PlayPen_StaticGeometryWithLOD::setupContent() kf->setTranslate(Vector3(2300, 600, 2300)); //animNode->attachObject(l); - l->setPosition(0, 600, 0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0, 600, 0))->attachObject(l); l->setAttenuation(10000, 1, 0, 0); AnimationState* animState = mSceneMgr->createAnimationState("an1"); @@ -6168,7 +6172,7 @@ void PlayPen_StencilGlow::setupContent(void) // Accept default settings: point light, white diffuse, just set position // NB I could attach the light to a SceneNode if I wanted it to move automatically with // other objects, but I don't - l->setPosition(20,80,50); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(20,80,50))->attachObject(l); // outline glow entity @@ -6249,7 +6253,7 @@ void PlayPen_StencilShadows::setupContent() //if(pointLight) //{ mLight = mSceneMgr->createLight("MainLight"); - mLight->setPosition(-400,400,-300); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-400,400,-300))->attachObject(mLight); mLight->setDiffuseColour(0.9, 0.9, 1); mLight->setSpecularColour(0.9, 0.9, 1); mLight->setAttenuation(6000,1,0.001,0); @@ -6402,7 +6406,7 @@ void PlayPen_StencilShadowsMixedOpSubMeshes::setupContent() //if(pointLight) //{ mLight = mSceneMgr->createLight("MainLight"); - mLight->setPosition(-400,400,-300); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(-400,400,-300))->attachObject(mLight); mLight->setDiffuseColour(0.9, 0.9, 1); mLight->setSpecularColour(0.9, 0.9, 1); mLight->setAttenuation(6000,1,0.001,0); @@ -7330,7 +7334,7 @@ void PlayPen_VertexTexture::setupContent() Light* l = mSceneMgr->createLight("MainLight"); l->setType(Light::LT_POINT); - l->setPosition(0, 200, 0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0, 200, 0))->attachObject(l); // Create single-channel floating point texture, no mips diff --git a/Tests/VisualTests/VTests/src/StencilShadowTest.cpp b/Tests/VisualTests/VTests/src/StencilShadowTest.cpp index ca483b740f9..a82e4b99b96 100644 --- a/Tests/VisualTests/VTests/src/StencilShadowTest.cpp +++ b/Tests/VisualTests/VTests/src/StencilShadowTest.cpp @@ -52,14 +52,14 @@ void StencilShadowTest::setupContent() light->setDiffuseColour(0.5f,0.4f,0.35f); light->setSpecularColour(0, 0, 0); light->setAttenuation(8000,1,0.0005,0); - light->setPosition(220,100,0); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(220, 100, 0))->attachObject(light); light->setCastShadows(true); light->setType(Light::LT_POINT); light = mSceneMgr->createLight("Light2"); light->setDiffuseColour(0.5f,0.4f,0.35f); light->setSpecularColour(0, 0, 0); light->setAttenuation(8000,1,0.0005,0); - light->setPosition(220,100,-200); + mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(220, 100, -200))->attachObject(light); light->setCastShadows(true); light->setType(Light::LT_POINT); diff --git a/Tests/VisualTests/VTests/src/TransparencyTest.cpp b/Tests/VisualTests/VTests/src/TransparencyTest.cpp index 012d9993c4b..f4bcf987836 100644 --- a/Tests/VisualTests/VTests/src/TransparencyTest.cpp +++ b/Tests/VisualTests/VTests/src/TransparencyTest.cpp @@ -42,7 +42,9 @@ void TransparencyTest::setupContent() mCameraNode->setPosition(0, 0, 300); // set camera's starting position - mSceneMgr->createLight()->setPosition(20, 80, 50); // add basic point light + mSceneMgr->getRootSceneNode() + ->createChildSceneNode(Vector3(20, 80, 50)) + ->attachObject(mSceneMgr->createLight()); // add basic point light // create a torus knot model, give it the translucent texture, and attach it to the origin Entity* ent = mSceneMgr->createEntity("Knot", "knot.mesh");