Skip to content

Commit f35f730

Browse files
author
Kenneth Lin
committed
Changes, changes, changes...
1 parent 2fc6984 commit f35f730

File tree

4 files changed

+40
-15
lines changed

4 files changed

+40
-15
lines changed

src/DustcloudParticleSystem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ vec3 DustcloudParticleSystem::getParticlePosition(Particle *p, float yval)
4545

4646
float DustcloudParticleSystem::getParticleSize(float yval)
4747
{
48-
return 3.0;//m_tornado->interpWidth(yval);
48+
return 5.0;//m_tornado->interpWidth(yval);
4949
}
5050

5151
float DustcloudParticleSystem::updateParticleRotation(float rot, float dt)

src/SplashParticleSystem.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "SplashParticleSystem.h"
22

3-
#define NUM_PARTICLES_SPLASH 10
3+
#define NUM_PARTICLES_SPLASH 40
44
#define SPLASH_CYCLE_SPEED -15.0
55
#define SPLASH_ROT_SPEED -6.0
66

@@ -28,7 +28,7 @@ SplashParticleSystem::~SplashParticleSystem()
2828
void SplashParticleSystem::spawnParticle(Particle *particle)
2929
{
3030
particle->position.setY(0.0);
31-
particle->maxLife = m_tornado->getHeight() / abs(m_cycleSpeed);
31+
particle->maxLife = m_tornado->getHeight() / abs(m_cycleSpeed) * 0.3;
3232
particle->rotation = 2.0 * M_PI * (double)rand() / RAND_MAX;
3333
}
3434

src/scene.cpp

+32-12
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Scene::~Scene()
3939
//delete tornado_;
4040
}
4141

42-
#define NUM_PARTICLE_SYSTEMS 6
42+
#define NUM_PARTICLE_SYSTEMS 5
4343

4444
void Scene::initialize()
4545
{
@@ -114,10 +114,10 @@ void Scene::initialize()
114114
Texture* dustMap = TextureCache::getInstance()->acquire("debris", TextureType::Texture2D);
115115
dPart->setParticleTexture(dustMap);
116116

117-
SplashParticleSystem* sPart = new SplashParticleSystem(tornado_);
117+
/*SplashParticleSystem* sPart = new SplashParticleSystem(tornado_);
118118
sPart->init();
119119
Texture* splashMap = TextureCache::getInstance()->acquire("tornado", TextureType::Texture2D);
120-
sPart->setParticleTexture(splashMap);
120+
sPart->setParticleTexture(splashMap);*/
121121

122122
//Mesh* mesh11 = MeshCache::getInstance()->acquire("bunny");
123123
phys_ = new PhysicsCollection();
@@ -130,7 +130,7 @@ void Scene::initialize()
130130
sceneObjects_.push_back(follower_);
131131
sceneObjects_.push_back(tPart);
132132
sceneObjects_.push_back(dPart);
133-
sceneObjects_.push_back(sPart);
133+
//sceneObjects_.push_back(sPart);
134134
sceneObjects_.push_back(wind);
135135
}
136136

@@ -194,6 +194,10 @@ void Scene::update(float dt)
194194
p->setGravity(false);
195195
// Set the velocity of this thing...
196196
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+
}
197201
out.normalize();
198202
out *= tornado_->getForce();
199203
out.setY(tornado_->getHeight() / 6.0);
@@ -220,19 +224,35 @@ void Scene::placeObject(const vec3 &point)
220224
vec3 pt = point;
221225
float height = terrain_->height(pt.x(), pt.z());
222226
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);
230227
PhysicsObject* p = new PhysicsObject(phys_);
231228
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+
}
232253
pt.setY(pt.y() + prad);
233254
p->setPosition(pt);
234255
p->setPhysicsRadius(prad);
235-
p->setMeshScale(5.0);
236256
p->setGravity(true);
237257
p->setMesh(mesh1);
238258
p->setMaterial(tmat);

src/view.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "drawcontext.h"
88
#include "orbitcameracontroller.h"
99
#include "fpscameracontroller.h"
10+
#include <QSound>
1011

1112
using namespace std;
1213

@@ -68,6 +69,10 @@ void View::initializeGL()
6869
cameraController_ = new FPSCameraController(camera_);
6970

7071
scene_ = new Scene();
72+
73+
//QSound *sound = new QSound("sounds/background.wav");
74+
//sound->setLoops(100);
75+
//sound->play();
7176
}
7277

7378
void View::paintGL()

0 commit comments

Comments
 (0)