SO3Engine
SO3LineEntity.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
31
32namespace SO3
33{
34
35SLineEntity::SLineEntity(SScene* parent, const std::string& entityName, bool dashed, bool disableDepth) : SNode(parent, entityName, SNode::LINE_ENTITY_TYPE_ID)
36{
37 lines = new SLines(Ogre::ColourValue::White, dashed, disableDepth);
39 O3SceneNode->attachObject(lines);
40}
41
42SLineEntity::SLineEntity() : SNode(0, "", SNode::LINE_ENTITY_TYPE_ID)
43{
44 // Forbiden (private)
45}
46
48{
50 O3SceneNode->detachObject(lines);
51 SO3_SAFE_DELETE(lines);
53}
54
56{
57 return lines;
58}
59
60void SLineEntity::SetCastShadows(const bool& castShadows)
61{
62 // Lines will never cast shadows
63}
64
66{
67 return false;
68}
69
70void SLineEntity::SetRenderingDistance(const float& distance)
71{
72 ogreMovableObject->setRenderingDistance(distance);
73}
74
76{
77 return ogreMovableObject->getRenderingDistance();
78}
79
80Ogre::Vector3 SLineEntity::GetBoundingBoxSize(const bool& childs)
81{
82 if (childs)
83 return GetSonsBoundingBox();
84
85 return Ogre::Vector3(0.0f, 0.0f, 0.0f);
86
87 /*Ogre::Vector3 scale = GetGlobalScale();
88 return (O3Entity->getBoundingBox().getSize() * scale);*/
89}
90
91Ogre::Vector3 SLineEntity::GetBoundingBoxCenter(const bool& childs)
92{
93 /*Ogre::Vector3 scale = GetGlobalScale();
94 return (O3Entity->getBoundingBox().getCenter() * scale);*/
95 return Ogre::Vector3::ZERO;
96}
97
98Ogre::Vector3 SLineEntity::GetWorldBoundingBoxSize(const bool& childs)
99{
100 if (childs)
102
103 return Ogre::Vector3(0.0f, 0.0f, 0.0f);
104
105 /*Ogre::Vector3 scale = GetGlobalScale();
106 return (O3Entity->getBoundingBox().getSize() * scale);*/
107}
108
109Ogre::Vector3 SLineEntity::GetWorldBoundingBoxCenter(const bool& childs)
110{
111 /*Ogre::Vector3 scale = GetGlobalScale();
112 return (O3Entity->getBoundingBox().getCenter() * scale);*/
113 return Ogre::Vector3::ZERO;
114}
115}
virtual bool GetCastShadows()
virtual Ogre::Vector3 GetBoundingBoxCenter(const bool &childs=false)
virtual void SetCastShadows(const bool &castShadows)
virtual Ogre::Vector3 GetWorldBoundingBoxSize(const bool &childs=false)
virtual Ogre::Vector3 GetBoundingBoxSize(const bool &childs=false)
virtual float GetRenderingDistance()
virtual Ogre::Vector3 GetWorldBoundingBoxCenter(const bool &childs=false)
virtual void SetRenderingDistance(const float &distance)
Ogre::Vector3 GetSonsWorldBoundingBox()
Ogre::SceneNode * O3SceneNode
Definition SO3NodeScol.h:69
void DetachFromParent()
Ogre::MovableObject * ogreMovableObject
Definition SO3NodeScol.h:70
Ogre::Vector3 GetSonsBoundingBox()