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
);
34 dMassSetBox(&m_mass
, density
, x
,y
,z
);
35 m_body
->setMass(&m_mass
);
51 glScalef(s
[0],s
[1],s
[2]);
63 Sphere::Sphere(float r
, float density
)
65 m_sphere
= new dSphere(World::Instance()->getSpace()->id(),r
);
67 dMassSetSphere(&m_mass
, density
, r
);
68 m_body
->setMass(&m_mass
);
82 s
= m_sphere
->getRadius();
85 //glutWireSphere(1,64,64);
86 static GLUquadricObj
*q
= 0;
90 gluQuadricNormals(q
, GL_SMOOTH
);
91 gluQuadricTexture(q
, GL_TRUE
);
92 glTexGeni(GL_S
, GL_TEXTURE_GEN_MODE
, GL_SPHERE_MAP
);
93 glTexGeni(GL_T
, GL_TEXTURE_GEN_MODE
, GL_SPHERE_MAP
);
98 glEnable(GL_TEXTURE_GEN_S);
99 glEnable(GL_TEXTURE_GEN_T);
100 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
101 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);