Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions engine/includes/components/effectrender.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef EFFECTRENDER_H
#define EFFECTRENDER_H

#include "renderable.h"

#include "resources/visualeffect.h"

class ENGINE_EXPORT EffectRender : public Renderable {
A_REGISTER(EffectRender, Renderable, Components/Effects)

A_PROPERTIES(
A_PROPERTYEX(VisualEffect *, effect, EffectRender::effect, EffectRender::setEffect, "editor=Asset")
)
A_NOMETHODS()

public:
EffectRender();
~EffectRender() override;

VisualEffect *effect() const;
void setEffect(VisualEffect *effect);

void deltaUpdate(float dt);

private:
AABBox localBound() const override;

Mesh *meshToDraw() const override;

void update() override;

static void effectUpdated(int state, void *ptr);

private:
std::vector<float> m_emitterData;

std::vector<float> m_particleData;

std::vector<float> m_renderData;

std::vector<int32_t> m_offsets;

VisualEffect *m_effect;
};

#endif // EFFECTRENDER_H
66 changes: 0 additions & 66 deletions engine/includes/components/particlerender.h

This file was deleted.

7 changes: 4 additions & 3 deletions engine/includes/editor/assetconverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ struct Template {
type(MetaType::INVALID) {

}
Template(const QString &p, const uint32_t t) :
path(p) {
type = MetaType::name(t);
Template(const QString &p, const QString &t) :
path(p),
type(t) {

type = type.replace("*", "");
type = type.trimmed();
}
Expand Down
141 changes: 0 additions & 141 deletions engine/includes/resources/particleeffect.h

This file was deleted.

113 changes: 113 additions & 0 deletions engine/includes/resources/visualeffect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#ifndef VISUALEFFECT_H
#define VISUALEFFECT_H

#include <resource.h>

#include <material.h>
#include <mesh.h>

class ENGINE_EXPORT VisualEffect : public Resource {
A_REGISTER(VisualEffect, Resource, Resources)

A_NOPROPERTIES()
A_NOMETHODS()
A_NOENUMS()

public:
struct Argument {
int32_t space;

int32_t size;

int32_t offset;
};

struct Operator {
int32_t op;

int32_t resultSpace;

int32_t resultOffset;

int32_t resultSize;

std::vector<Argument> arguments;

std::vector<float> constData;
};

enum EmitterAttributes {
EmitterAge = 0,
DeltaTime,
AliveParticles,
SpawnRate,
SpawnCounter,
LastAttribute
};

public:
VisualEffect();

void update(std::vector<float> &emitter, std::vector<float> &particles, std::vector<float> &render);

int capacity() const;
void setCapacity(int capacity);

Mesh *mesh() const;
void setMesh(Mesh *mesh);

Material *material() const;
void setMaterial(Material *material);

float spawnRate() const;
void setSpawnRate(float rate);

bool local() const;
void setLocal(bool local);

bool gpu() const;
void setGpu(bool gpu);

bool continous() const;
void setContinous(bool continuous);

int particleStride() const;
int renderableStride() const;

AABBox bound() const;

void loadUserData(const VariantMap &data) override;

protected:
std::vector<Operator> m_spawnOperations;
std::vector<Operator> m_updateOperations;
std::vector<Operator> m_renderOperations;

AABBox m_aabb;

Mesh *m_mesh;

Material *m_material;

float m_spawnRate;

int m_capacity;

int m_particleStride;

int m_renderableStride;

bool m_gpu;

bool m_local;

bool m_continous;

private:
void apply(std::vector<Operator> &operations, std::vector<float> &emitter, std::vector<float> &particle, std::vector<float> &render, int stage) const;

void loadOperations(const VariantList &list, std::vector<Operator> &operations);

};

#endif // VISUALEFFECT_H
Loading
Loading