1 /************************************************************************
2 This file is part of NE.
4 NE is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 NE 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.
14 You should have received a copy of the GNU General Public License
15 along with NE. If not, see <http://www.gnu.org/licenses/>.
16 ************************************************************************/
18 #include "generic_objects.h"
20 #include "backend/shapes.h"
30 Box::Box(float x
, float y
, float z
, float density
)
32 m_box
= new dBox(World::Instance()->getSpace()->id(),x
,y
,z
);
35 m_mass
.setBox(density
, x
, y
, z
);
36 m_body
->setMass(&m_mass
);
53 glScalef(s
[0],s
[1],s
[2]);
65 Sphere::Sphere(float r
, float density
)
67 m_sphere
= new dSphere(World::Instance()->getSpace()->id(),r
);
70 m_mass
.setSphere(density
, r
);
71 m_body
->setMass(&m_mass
);
86 s
= m_sphere
->getRadius();
89 //glutWireSphere(1,64,64);
90 static GLUquadricObj
*q
= 0;
94 gluQuadricNormals(q
, GL_SMOOTH
);
95 gluQuadricTexture(q
, GL_TRUE
);
96 glTexGeni(GL_S
, GL_TEXTURE_GEN_MODE
, GL_SPHERE_MAP
);
97 glTexGeni(GL_T
, GL_TEXTURE_GEN_MODE
, GL_SPHERE_MAP
);
100 gluSphere(q
,1,32,32);
102 glEnable(GL_TEXTURE_GEN_S);
103 glEnable(GL_TEXTURE_GEN_T);
104 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
105 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);