@@ -39,7 +39,7 @@ Scene::~Scene()
39
39
// delete tornado_;
40
40
}
41
41
42
- #define NUM_PARTICLE_SYSTEMS 6
42
+ #define NUM_PARTICLE_SYSTEMS 5
43
43
44
44
void Scene::initialize ()
45
45
{
@@ -114,10 +114,10 @@ void Scene::initialize()
114
114
Texture* dustMap = TextureCache::getInstance ()->acquire (" debris" , TextureType::Texture2D);
115
115
dPart->setParticleTexture (dustMap);
116
116
117
- SplashParticleSystem* sPart = new SplashParticleSystem (tornado_);
117
+ /* SplashParticleSystem* sPart = new SplashParticleSystem(tornado_);
118
118
sPart->init();
119
119
Texture* splashMap = TextureCache::getInstance()->acquire("tornado", TextureType::Texture2D);
120
- sPart ->setParticleTexture (splashMap);
120
+ sPart->setParticleTexture(splashMap);*/
121
121
122
122
// Mesh* mesh11 = MeshCache::getInstance()->acquire("bunny");
123
123
phys_ = new PhysicsCollection ();
@@ -130,7 +130,7 @@ void Scene::initialize()
130
130
sceneObjects_.push_back (follower_);
131
131
sceneObjects_.push_back (tPart);
132
132
sceneObjects_.push_back (dPart);
133
- sceneObjects_.push_back (sPart );
133
+ // sceneObjects_.push_back(sPart);
134
134
sceneObjects_.push_back (wind);
135
135
}
136
136
@@ -194,6 +194,10 @@ void Scene::update(float dt)
194
194
p->setGravity (false );
195
195
// Set the velocity of this thing...
196
196
vec3 out = {-diff.z () - (0.5 * diff.x ()), 0.0 , diff.x () - (0.5 * diff.z ())};
197
+ if (pos.y () - tornadoY < (0.3 * tornado_->getHeight ())){
198
+ out += {(-0.5 * diff.x ()), 0.0 , (-0.5 * diff.x ())};
199
+ p->addAngleVelocity ({20 * dt, 20 * dt, 20 * dt});
200
+ }
197
201
out.normalize ();
198
202
out *= tornado_->getForce ();
199
203
out.setY (tornado_->getHeight () / 6.0 );
@@ -220,19 +224,35 @@ void Scene::placeObject(const vec3 &point)
220
224
vec3 pt = point;
221
225
float height = terrain_->height (pt.x (), pt.z ());
222
226
pt.setY (height);
223
-
224
- Mesh* mesh1 = MeshCache::getInstance ()->acquire (" bunny" );
225
- PhongMaterial* tmat = new PhongMaterial;
226
- tmat->setAmbient ({0.2 , 0.2 , 0.2 });
227
- tmat->setDiffuse ({0.7 , 0.7 , 0.7 });
228
- tmat->setSpecular ({0.7 , 0.7 , 0.7 });
229
- tmat->setShiness (100 );
230
227
PhysicsObject* p = new PhysicsObject (phys_);
231
228
float prad = 1.8 ;
229
+ Mesh* mesh1 = NULL ;
230
+ PhongMaterial* tmat = NULL ;
231
+ if (randf (0.0 , 1.0 ) > 0.5 ){
232
+ mesh1 = MeshCache::getInstance ()->acquire (" bunny" );
233
+ tmat = new PhongMaterial;
234
+ tmat->setAmbient ({0.2 , 0.2 , 0.2 });
235
+ tmat->setDiffuse ({0.7 , 0.7 , 0.7 });
236
+ tmat->setSpecular ({0.7 , 0.7 , 0.7 });
237
+ tmat->setShiness (100 );
238
+ prad = 1.8 ;
239
+ p->setMeshScale (5.0 );
240
+ }
241
+ else {
242
+ mesh1 = MeshCache::getInstance ()->acquire (" stone" );
243
+ tmat = new PhongMaterial;
244
+ tmat->setAmbient ({0.2 , 0.2 , 0.2 });
245
+ tmat->setDiffuse ({0.7 , 0.7 , 0.7 });
246
+ tmat->setSpecular ({0.7 , 0.7 , 0.7 });
247
+ tmat->setShiness (100 );
248
+ Texture* diffuseMap = TextureCache::getInstance ()->acquire (" stone" , TextureType::Texture2D);
249
+ tmat->setDiffuseMap (diffuseMap);
250
+ prad = 2.1 ;
251
+ p->setMeshScale (7.5 );
252
+ }
232
253
pt.setY (pt.y () + prad);
233
254
p->setPosition (pt);
234
255
p->setPhysicsRadius (prad);
235
- p->setMeshScale (5.0 );
236
256
p->setGravity (true );
237
257
p->setMesh (mesh1);
238
258
p->setMaterial (tmat);
0 commit comments