Implemented entity cloning
This commit is contained in:
@@ -14,6 +14,8 @@ struct Box : Component
|
||||
float Width;
|
||||
float Height;
|
||||
float Depth;
|
||||
|
||||
virtual Box* Clone() const override { return new Box(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ struct Camera : Component
|
||||
float FOV;
|
||||
float NearClip;
|
||||
float FarClip;
|
||||
|
||||
virtual Camera* Clone() const override { return new Camera(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ struct DirectionalLight : Component
|
||||
float MaxRange;
|
||||
float SpecularIntensity;
|
||||
Color Color;
|
||||
|
||||
virtual DirectionalLight* Clone() const override { return new DirectionalLight(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ struct FreeSteering : Component
|
||||
{
|
||||
FreeSteering() : Speed(35) { }
|
||||
float Speed;
|
||||
|
||||
virtual FreeSteering* Clone() const override { return new FreeSteering(*this); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ struct Input : Component
|
||||
std::array<int, GLFW_MOUSE_BUTTON_LAST+1> LastMouseState;
|
||||
float dX, dY;
|
||||
float WheelDelta;
|
||||
|
||||
virtual Input* Clone() const override { return new Input(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ struct Model : Component
|
||||
Color Color;
|
||||
bool Visible;
|
||||
bool ShadowCaster;
|
||||
|
||||
virtual Model* Clone() const override { return new Model(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Components
|
||||
double LifeTime;
|
||||
std::vector<glm::vec3> VelocitySpectrum;
|
||||
std::vector<glm::vec3> AngularVelocitySpectrum;
|
||||
|
||||
virtual Particle* Clone() const override { return new Particle(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ struct ParticleEmitter : Component
|
||||
std::vector<glm::vec3> VelocitySpectrum;
|
||||
std::vector<glm::vec3> AngularVelocitySpectrum;
|
||||
|
||||
virtual ParticleEmitter* Clone() const override { return new ParticleEmitter(*this); }
|
||||
|
||||
private:
|
||||
double TimeSinceLastSpawn;
|
||||
};
|
||||
|
||||
@@ -12,6 +12,8 @@ struct Physics : Component
|
||||
: Mass(0.f) { }
|
||||
|
||||
float Mass;
|
||||
|
||||
virtual Physics* Clone() const override { return new Physics(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ struct PointLight : Component
|
||||
float constantAttenuation, linearAttenuation, quadraticAttenuation;
|
||||
float spotExponent;
|
||||
Color color;
|
||||
|
||||
virtual PointLight* Clone() const override { return new PointLight(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ struct SoundEmitter : Component
|
||||
float Pitch;
|
||||
bool Loop;
|
||||
std::string Path;
|
||||
|
||||
virtual SoundEmitter* Clone() const override { return new SoundEmitter(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ struct Sphere : Component
|
||||
: Radius(1.f){ }
|
||||
|
||||
float Radius;
|
||||
|
||||
virtual Sphere* Clone() const override { return new Sphere(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ struct Sprite : Component
|
||||
{
|
||||
std::string SpriteFile;
|
||||
Color Color;
|
||||
|
||||
virtual Sprite* Clone() const override { return new Sprite(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,12 @@
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct Template : Component { };
|
||||
struct Template
|
||||
: public Component
|
||||
{
|
||||
virtual Template* Clone() const override { return nullptr; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // !Components_Template_h__
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct Transform : Component
|
||||
struct Transform : public Component
|
||||
{
|
||||
Transform()
|
||||
: Scale(glm::vec3(1.f)) { }
|
||||
@@ -15,6 +15,8 @@ struct Transform : Component
|
||||
glm::quat Orientation;
|
||||
glm::vec3 Velocity;
|
||||
glm::vec3 Scale;
|
||||
|
||||
virtual Transform* Clone() const override { return new Transform(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user