-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAmbientLight.cpp
65 lines (50 loc) · 1.58 KB
/
AmbientLight.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2006 Torus Knot Software Ltd
Also see acknowledgements in Readme.html
You may use this sample code for anything you like, it is not covered by the
LGPL like the rest of the engine.
-----------------------------------------------------------------------------
*/
#include "AmbientLight.h"
#include "GeomUtils.h"
#include "OgreMaterialManager.h"
using namespace Ogre;
AmbientLight::AmbientLight()
{
setRenderQueueGroup(RENDER_QUEUE_2);
mRenderOp.vertexData = new VertexData();
mRenderOp.indexData = 0;
GeomUtils::createQuad(mRenderOp.vertexData);
mRenderOp.operationType = RenderOperation::OT_TRIANGLE_STRIP;
mRenderOp.useIndexes = false;
// Set bounding
setBoundingBox(AxisAlignedBox(-10000,-10000,-10000,10000,10000,10000));
mRadius = 15000;
mMatPtr = MaterialManager::getSingleton().getByName("DeferredShading/AmbientLight");
assert(mMatPtr.isNull()==false);
mMatPtr->load();
}
AmbientLight::~AmbientLight()
{
// need to release IndexData and vertexData created for renderable
delete mRenderOp.indexData;
delete mRenderOp.vertexData;
}
/** @copydoc MovableObject::getBoundingRadius */
Real AmbientLight::getBoundingRadius(void) const
{
return mRadius;
}
/** @copydoc Renderable::getSquaredViewDepth */
Real AmbientLight::getSquaredViewDepth(const Camera*) const
{
return 0.0;
}
const MaterialPtr& AmbientLight::getMaterial(void) const
{
return mMatPtr;
}