init commit

This commit is contained in:
2025-06-11 22:45:11 +08:00
commit 71307f3e53
115 changed files with 13922 additions and 0 deletions
@@ -0,0 +1,52 @@
#pragma once
#include "dvc_component.h"
#include "math/dvc_vector3.h"
#include "math/dvc_matrix4.h"
DV_CORE_BEGIN_NAMESPACE
class DV_CORE_API CameraComponent : public SceneComponent
{
public:
struct CameraDefine
{
float32_t fov;
float32_t aspect;
float32_t nearClip;
float32_t farClip;
};
public:
virtual const std::string& getTypeName() const { return typeName(); }
virtual void render(const fMatrix4& transParent, RenderQueue& queue) const;
fVector3 getEye(void) const;
fVector3 getLookat(void) const;
fVector3 getUp(void) const;
void setCameraDefine(const CameraDefine& cameraDefine);
CameraDefine getCameraDefine() const {
return m_cameraDefine;
}
const fMatrix4& getViewMatrix(void) const {
return m_viewMatrix;
}
const fMatrix4& getViewProjMatrix(void) const {
return m_viewProjMatrix;
}
protected:
CameraDefine m_cameraDefine;
fMatrix4 m_viewMatrix;
fMatrix4 m_viewProjMatrix;
public:
CameraComponent(SceneNodePtr owner);
virtual ~CameraComponent();
static const std::string& typeName();
};
DV_CORE_END_NAMESPACE
@@ -0,0 +1,22 @@
#pragma once
#include "dvc_config.h"
#include "math/dvc_matrix4.h"
DV_CORE_BEGIN_NAMESPACE
class DV_CORE_API SceneComponent
{
public:
virtual const std::string& getTypeName() const = 0;
virtual void render(const fMatrix4& transParent, RenderQueue& queue) const;
protected:
SceneNodePtr m_owner;
public:
SceneComponent(SceneNodePtr owner);
virtual ~SceneComponent();
};
DV_CORE_END_NAMESPACE
@@ -0,0 +1,43 @@
#pragma once
#include "dvc_component.h"
#include "math/dvc_vector3.h"
//#include
DV_CORE_BEGIN_NAMESPACE
class DV_CORE_API LightComponent : public SceneComponent
{
public:
enum LightType
{
LT_Point,
LT_Directional,
LT_Spot,
};
struct LightDefine
{
LightType type;
fVector3 color; //default is "1.0, 1.0, 1.0"
float32_t intensity; //default is "1.0"
float32_t range; //default is "-1", means infinite
float32_t innerConeAngle; //only for spot light, default is 0
float32_t outerConeAngle; //only for spot light, default is PI/4.0
};
public:
virtual const std::string& getTypeName() const { return typeName(); }
virtual void render(const fMatrix4& transParent, RenderQueue& queue) const;
void setLightDefine(const LightDefine& lightDefine);
protected:
LightDefine m_define;
public:
LightComponent(SceneNodePtr owner);
virtual ~LightComponent();
static const std::string& typeName();
};
DV_CORE_END_NAMESPACE
@@ -0,0 +1,26 @@
#pragma once
#include "dvc_component.h"
#include "dvc_pre_declare.h"
DV_CORE_BEGIN_NAMESPACE
class DV_CORE_API MeshComponent : public SceneComponent
{
public:
virtual const std::string& getTypeName() const { return typeName(); }
virtual void render(const fMatrix4& transParent, RenderQueue& queue) const;
void setMesh(MeshConstPtr mesh);
protected:
MeshConstPtr m_mesh;
public:
MeshComponent(SceneNodePtr owner);
virtual ~MeshComponent();
static const std::string& typeName();
};
DV_CORE_END_NAMESPACE