1 // This file belongs to the "MiniCore" game engine.
2 // Copyright (C) 2011 Jussi Lind <jussi.lind@iki.fi>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 // MA  02110-1301, USA.
18 //
19 
20 #include "mcobjectdata.hh"
21 
MCObjectData(const std::string & typeId)22 MCObjectData::MCObjectData(const std::string & typeId)
23   : m_typeId(typeId)
24   , m_mass(0.0)
25   , m_shape(MCObjectData::Default)
26   , m_shapeRadius(0.0)
27   , m_shapeWidth(0.0)
28   , m_shapeHeight(0.0)
29   , m_restitution(0.5)
30   , m_xyFriction(0.0)
31   , m_stationary(false)
32   , m_angle(0)
33 {
34 }
35 
typeId() const36 std::string MCObjectData::typeId() const
37 {
38     return m_typeId;
39 }
40 
setMass(float newMass)41 void MCObjectData::setMass(float newMass)
42 {
43     m_mass = newMass;
44 }
45 
mass() const46 float MCObjectData::mass() const
47 {
48     return m_mass;
49 }
50 
setShapeRadius(float radius)51 void MCObjectData::setShapeRadius(float radius)
52 {
53     m_shape = MCObjectData::Circle;
54     m_shapeRadius = radius;
55 }
56 
shapeRadius() const57 float MCObjectData::shapeRadius() const
58 {
59     return m_shapeRadius;
60 }
61 
setShapeWidth(float width)62 void MCObjectData::setShapeWidth(float width)
63 {
64     m_shape = MCObjectData::Rect;
65     m_shapeWidth = width;
66 }
67 
shapeWidth() const68 float MCObjectData::shapeWidth() const
69 {
70     return m_shapeWidth;
71 }
72 
setShapeHeight(float height)73 void MCObjectData::setShapeHeight(float height)
74 {
75     m_shape = MCObjectData::Rect;
76     m_shapeHeight = height;
77 }
78 
shapeHeight() const79 float MCObjectData::shapeHeight() const
80 {
81     return m_shapeHeight;
82 }
83 
shape() const84 MCObjectData::Shape MCObjectData::shape() const
85 {
86     return m_shape;
87 }
88 
setRestitution(float restitution)89 void MCObjectData::setRestitution(float restitution)
90 {
91     m_restitution = restitution;
92 }
93 
restitution() const94 float MCObjectData::restitution() const
95 {
96     return m_restitution;
97 }
98 
setXYFriction(float friction)99 void MCObjectData::setXYFriction(float friction)
100 {
101     m_xyFriction = friction;
102 }
103 
xyFriction() const104 float MCObjectData::xyFriction() const
105 {
106     return m_xyFriction;
107 }
108 
setIsStationary(bool stationary)109 void MCObjectData::setIsStationary(bool stationary)
110 {
111     m_stationary = stationary;
112 }
113 
stationary() const114 bool MCObjectData::stationary() const
115 {
116     return m_stationary;
117 }
118 
setInitialLocation(MCVector3dF location)119 void MCObjectData::setInitialLocation(MCVector3dF location)
120 {
121     m_location = location;
122 }
123 
initialLocation() const124 MCVector3dF MCObjectData::initialLocation() const
125 {
126     return m_location;
127 }
128 
setInitialAngle(int angle)129 void MCObjectData::setInitialAngle(int angle)
130 {
131     m_angle = angle;
132 }
133 
initialAngle() const134 int MCObjectData::initialAngle() const
135 {
136     return m_angle;
137 }
138