Exemplo n.º 1
0
FireflySystem::FireflySystem(const Mesh& mesh, const Mesh& glow_mesh, 
      TextureType texture_type, const glm::vec3& origin, int numParticles) :
            draw_template_({
                  ShaderType::DEFERRED,
                  mesh, 
                  Material(),
                  Texture(texture_type, DIFFUSE_TEXTURE),
                  boost::none,
                  EffectSet({EffectType::CASTS_SHADOW, EffectType::CASTS_REFLECTION})
                  }),
            draw_template_glow_({
                  ShaderType::FINAL_LIGHT_PASS,
                  glow_mesh, 
                  Material(),
                  Texture(texture_type, DIFFUSE_TEXTURE),
                  boost::none,
                  EffectSet({EffectType::IS_FIREFLY, EffectType::IS_GOD_RAY})
                  }),
            origin_(origin),
            scale_(0.3f),
            velocity_(glm::vec3(0.001f, 0.0f, 0.0f)),
            acceleration_(glm::vec3(0.0f, 0.0f, 0.0f)) {
               for (int i = 0; i < numParticles; i++) {
                  float rvx = MIN + static_cast <float> (rand()) / static_cast <float> (RAND_MAX / (MAX - MIN));
                  float rvz = MIN + static_cast <float> (rand()) / static_cast <float> (RAND_MAX / (MAX - MIN));
                  float rx = static_cast <float> (rand()) / static_cast <float> (RAND_MAX / 10.0f);
                  float ry = static_cast <float> (rand()) / static_cast <float> (RAND_MAX / 10.0f);
                  float rz = static_cast <float> (rand()) / static_cast <float> (RAND_MAX / 10.0f);
                  particles_.push_back(Particle(glm::vec3(origin_.x + rx, origin_.y + ry, origin_.z + rz), scale_, rand(),
                                       glm::vec3(rvx, 0.0f, rvz), acceleration_));

               }
               //draw_template_.mesh.material = Material(glm::vec3(0.7, 0.24, 0.15));
            }
Exemplo n.º 2
0
RockGenerator::RockGenerator(const Mesh& mesh, const GroundPlane& ground) :
    draw_template_( {
    ShaderType::DEFERRED,
               mesh,
               Material(),
               Texture(TextureType::ROCK, DIFFUSE_TEXTURE),
               boost::none,
               EffectSet({EffectType::CASTS_SHADOW, EffectType::CASTS_REFLECTION})
})
{
    draw_template_.material = Material(glm::vec3(0.45, 0.24, 0.15));
    generate(ground);
}
Exemplo n.º 3
0
LeafSystem::LeafSystem(const Mesh& mesh, TextureType texture_type, const glm::vec3& origin, int numParticles) : 
            draw_template_({
                  ShaderType::DEFERRED,
                  mesh, 
                  Material(),
                  Texture(texture_type, DIFFUSE_TEXTURE),
                  boost::none,
                  EffectSet({EffectType::CASTS_SHADOW, EffectType::CASTS_REFLECTION})
                  }),
            origin_(origin),
            scale_(0.7f),
            velocity_(glm::vec3(0.0f, -0.00001f, 0.0f)),
            acceleration_(glm::vec3(0.0f, -0.000001f, 0.0f)) {
               for (int i = 0; i < numParticles; i++) {
                  glm::vec3 randVec = getRandomVec();
                  float randAngle = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / ROT_MAX));
                  particles_.push_back(Particle(glm::vec3(origin_.x + randVec.x, origin_.y + randVec.y, origin_.z + randVec.z), 
                              scale_, randAngle, velocity_,  acceleration_));
               }
            }
Exemplo n.º 4
0
	}
	if ( oldest_chan < 0 ) {
		NosuchDebug("HEY!! findSoundChannel region=%d - resorting to existing channel %d for sound %s",
			regionid, existingchan,nm.c_str());
		ChannelLastChange[existingchan] = Palette::now;
		return existingchan;
	}
	NosuchDebug(1,"findSoundChannel region=%d - oldest_chan is %d for sound %s, setting lastchange to %d",
		regionid, oldest_chan,nm.c_str(),Palette::now);
	ChannelLastChange[oldest_chan] = Palette::now;
	return oldest_chan;
}

#if 0
EffectSet buttonEffectSet[NUM_EFFECT_SETS] = {
	EffectSet(1,0,0,0,0,0,0,0,0,0,0,0,0),   // 0 - all effects off
	EffectSet(1,1,0,0,0,0,0,0,0,1,0,1,0),   // 1 - twisted, wave warp, edge detect, mirror
	EffectSet(0,0,0,0,0,0,0,0,1,1,0,0,1),   // 2 - iterate, edge detection, trails   GOOD
	EffectSet(1,0,0,1,0,0,0,1,0,0,0,0,1),   // 3 - twisted, blur, displace, trails GOOD?
	EffectSet(1,1,0,0,0,0,0,0,0,0,0,0,0),   // 4 - twisted, wave warp
	EffectSet(1,0,0,0,0,0,1,0,0,1,0,0,1),   // 5 - twisted, blur, posterize, edge detect, trails
	EffectSet(0,0,0,0,1,0,0,0,0,0,0,0,0),   // 6 - goo
	EffectSet(0,0,0,0,0,1,0,0,0,1,0,0,0),   // 7 - fragment, edge
	EffectSet(1,0,0,1,0,0,0,0,1,0,1,1,1),   // 8 - twisted, blur, iterate, blendoscope, mirror, trails
	EffectSet(1,0,1,0,0,0,0,0,0,0,0,0,1),   // 9 - twisted, kaleidoscope, trails  (TRY WITHOUT KALIED!)
	EffectSet(0,0,0,1,0,1,0,0,0,1,0,0,0),   // 10 - blur, fragment, edge detect
	EffectSet(0,0,0,0,1,0,0,1,0,0,0,0,1),   // 11 - goo, trails
};
#endif

Palette::Palette(PaletteHost* b) {