Skip to content

Commit

Permalink
Update for API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravbug committed Jun 14, 2024
1 parent f42290c commit 6440e5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion RavEngine
24 changes: 6 additions & 18 deletions Samples/Rendering/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,11 @@ struct SmokeParticleUpdateMaterial : public ParticleUpdateMaterial {
SmokeParticleUpdateMaterial() : ParticleUpdateMaterial("SmokeParticleInit", "SmokeParticleUpdate") {};
};

struct SmokeParticleRenderMaterial : public RavEngine::BillboardRenderParticleMaterial {
SmokeParticleRenderMaterial() : BillboardRenderParticleMaterial("default_billboard_particle","default_billboard_particle") {}

uint16_t ParticleUserDataSize() const final {
return 0; // needs no extra data
}
};

struct FireParticleUpdateMaterial : public ParticleUpdateMaterial {
FireParticleUpdateMaterial() : ParticleUpdateMaterial("FireParticleInit", "FireParticleUpdate") {}
};

struct FireParticleRenderMaterial : public RavEngine::BillboardRenderParticleMaterial {
FireParticleRenderMaterial() : BillboardRenderParticleMaterial("default_billboard_particle", "default_billboard_particle") {};

uint16_t ParticleUserDataSize() const final {
return 0;
}
};

struct Level : public RavEngine::World {

Expand Down Expand Up @@ -120,14 +106,16 @@ struct Level : public RavEngine::World {
lightsEntity.GetTransform().LocalRotateDelta(vector3{ deg_to_rad(45), deg_to_rad(45),0 });

auto smokeParticleEntity = Instantiate<GameObject>();
auto smokeRenderMat = RavEngine::New<SmokeParticleRenderMaterial>();
auto particleRenderMat = New<SpritesheetParticleRenderMaterial>();

auto smokeRenderMat = RavEngine::New<BillboardParticleRenderMaterialInstance>(particleRenderMat);
smokeRenderMat->spriteTex = Texture::Manager::Get("smoke.png");
smokeRenderMat->spriteDim = {
.numSpritesWidth = 3,
.numSpritesHeight = 3
};

auto smokeUpdateMat = New<SmokeParticleUpdateMaterial>();
auto smokeUpdateMat = New<ParticleUpdateMaterialInstance>(New<SmokeParticleUpdateMaterial>());

auto& smokeEmitter = smokeParticleEntity.EmplaceComponent<ParticleEmitter>(8192, smokeUpdateMat, smokeRenderMat); // number of particles we want
//smokeEmitter.mode = ParticleEmitter::Mode::Burst;
Expand All @@ -136,13 +124,13 @@ struct Level : public RavEngine::World {
smokeEmitter.SetEmissionRate(1000);

auto fireParticleEntity = Instantiate<GameObject>();
auto fireRenderMat = New<FireParticleRenderMaterial>();
auto fireRenderMat = RavEngine::New<BillboardParticleRenderMaterialInstance>(particleRenderMat);
fireRenderMat->spriteTex = Texture::Manager::Get("fire.png");
fireRenderMat->spriteDim = {
.numSpritesWidth = 11,
.numSpritesHeight = 1
};
auto fireUpdateMat = New<FireParticleUpdateMaterial>();
auto fireUpdateMat = New<ParticleUpdateMaterialInstance>(New<FireParticleUpdateMaterial>());
auto& fireEmitter = fireParticleEntity.EmplaceComponent<ParticleEmitter>(8192, fireUpdateMat, fireRenderMat);
fireEmitter.Play();
fireEmitter.SetEmissionRate(1000);
Expand Down

0 comments on commit 6440e5c

Please sign in to comment.