feat: add basic layout for CKLight and CKCamera.
- add basic class layout and member function for CKLight and CKCamera. - register CKLight and CKCamera in CKGlobals to let CK engine can recognize them. - modify EnumsMigration to add new 2 enums for CKLight and CKCamera.
This commit is contained in:
@ -48,6 +48,8 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
CKDWORD m_ZOrder; // replace the whole heavy CKSceneGraphNode
|
||||
|
||||
VxMath::VX_MOVEABLE_FLAGS m_MoveableFlags;
|
||||
// YYCMARK: This field is called m_EntityFlags in reverse project.
|
||||
// I change this because I want to give it a more explicit name to make it is different with other flags.
|
||||
CK_3DENTITY_FLAGS m_3dEntityFlags;
|
||||
|
||||
};
|
||||
|
@ -1,8 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
#include "CK3dEntity.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
class CKCamera : public CK3dEntity {
|
||||
public:
|
||||
CKCamera(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKCamera();
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKCamera);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_CAMERA;
|
||||
}
|
||||
|
||||
// 2 RW funcions
|
||||
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
|
||||
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
|
||||
|
||||
|
||||
CK_CAMERA_PROJECTION GetProjectionType() const;
|
||||
void SetProjectionType(CK_CAMERA_PROJECTION proj);
|
||||
|
||||
CKFLOAT GetOrthographicZoom() const;
|
||||
void SetOrthographicZoom(CKFLOAT zoom);
|
||||
|
||||
CKFLOAT GetFrontPlane() const;
|
||||
CKFLOAT GetBackPlane() const;
|
||||
CKFLOAT GetFov() const;
|
||||
void SetFrontPlane(CKFLOAT front);
|
||||
void SetBackPlane(CKFLOAT back);
|
||||
void SetFov(CKFLOAT fov);
|
||||
|
||||
void GetAspectRatio(int& width, int& height) const;
|
||||
void SetAspectRatio(int width, int height);
|
||||
|
||||
void ComputeProjectionMatrix(VxMath::VxMatrix& mat) const;
|
||||
|
||||
// Roll Angle
|
||||
void ResetRoll();
|
||||
void Roll(CKFLOAT angle);
|
||||
|
||||
// Target access
|
||||
virtual CK3dEntity* GetTarget() const;
|
||||
virtual void SetTarget(CK3dEntity* target);
|
||||
|
||||
protected:
|
||||
CKFLOAT m_Fov;
|
||||
CKFLOAT m_FrontPlane, m_BackPlane;
|
||||
CK_CAMERA_PROJECTION m_ProjectType;
|
||||
CKFLOAT m_OrthographicZoom;
|
||||
CKDWORD m_Width, m_Height;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
#include "CK3dEntity.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
class CKLight : public CK3dEntity {
|
||||
public:
|
||||
CKLight(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKLight();
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKLight);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_LIGHT;
|
||||
}
|
||||
|
||||
// 2 RW funcions
|
||||
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
|
||||
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
|
||||
|
||||
// Type
|
||||
VxMath::VXLIGHT_TYPE GetType() const;
|
||||
void SetType(VxMath::VXLIGHT_TYPE light_type);
|
||||
|
||||
const VxMath::VxColor& GetColor() const;
|
||||
void SetColor(const VxMath::VxColor& c);
|
||||
|
||||
CKFLOAT GetConstantAttenuation() const;
|
||||
CKFLOAT GetLinearAttenuation() const;
|
||||
CKFLOAT GetQuadraticAttenuation() const;
|
||||
void SetConstantAttenuation(CKFLOAT value);
|
||||
void SetLinearAttenuation(CKFLOAT value);
|
||||
void SetQuadraticAttenuation(CKFLOAT value);
|
||||
|
||||
// Range
|
||||
CKFLOAT GetRange() const;
|
||||
void SetRange(CKFLOAT value);
|
||||
|
||||
// Spotlight options
|
||||
CKFLOAT GetHotSpot() const;
|
||||
CKFLOAT GetFalloff() const;
|
||||
CKFLOAT GetFalloffShape() const;
|
||||
void SetHotSpot(CKFLOAT value);
|
||||
void SetFalloff(CKFLOAT value);
|
||||
void SetFalloffShape(CKFLOAT value);
|
||||
|
||||
// Activity options
|
||||
bool GetActivity() const;
|
||||
void Active(bool active);
|
||||
|
||||
bool GetSpecularFlag() const;
|
||||
void SetSpecularFlag(bool specular);
|
||||
|
||||
// Target access
|
||||
virtual CK3dEntity* GetTarget() const;
|
||||
virtual void SetTarget(CK3dEntity* target);
|
||||
|
||||
CKFLOAT GetLightPower() const;
|
||||
void SetLightPower(CKFLOAT power = 1.0f);
|
||||
|
||||
protected:
|
||||
struct CKLightData {
|
||||
VxMath::VXLIGHT_TYPE m_Type;
|
||||
VxMath::VxColor m_Diffuse;
|
||||
VxMath::VxColor m_Specular;
|
||||
VxMath::VxColor m_Ambient;
|
||||
VxMath::VxVector3 m_Position;
|
||||
VxMath::VxVector3 m_Direction;
|
||||
CKFLOAT m_Range;
|
||||
CKFLOAT m_Falloff;
|
||||
CKFLOAT m_Attenuation0;
|
||||
CKFLOAT m_Attenuation1;
|
||||
CKFLOAT m_Attenuation2;
|
||||
CKFLOAT m_InnerSpotCone;
|
||||
CKFLOAT m_OuterSpotCone;
|
||||
};
|
||||
|
||||
CKLightData m_LightData;
|
||||
// YYCMARK: This variable is called in m_Flags in reverse code.
|
||||
DWORD m_LightFlags;
|
||||
CKFLOAT m_LightPower;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
#include "CKCamera.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
class CKTargetCamera : public CKCamera {
|
||||
public:
|
||||
CKTargetCamera(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKTargetCamera();
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKTargetCamera);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_TARGETCAMERA;
|
||||
}
|
||||
|
||||
virtual void CheckPreDeletion() override;
|
||||
|
||||
// 2 RW funcions
|
||||
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
|
||||
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
|
||||
|
||||
|
||||
virtual CK3dEntity* GetTarget() const;
|
||||
virtual void SetTarget(CK3dEntity* target);
|
||||
|
||||
protected:
|
||||
CK_ID m_Target3dEntity;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
#include "CKLight.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
class CKTargetLight : public CKLight {
|
||||
public:
|
||||
CKTargetLight(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKTargetLight();
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKTargetLight);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_TARGETLIGHT;
|
||||
}
|
||||
|
||||
virtual void CheckPreDeletion() override;
|
||||
|
||||
// 2 RW funcions
|
||||
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
|
||||
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
|
||||
|
||||
|
||||
virtual CK3dEntity* GetTarget() const;
|
||||
virtual void SetTarget(CK3dEntity* target);
|
||||
|
||||
protected:
|
||||
CK_ID m_Target3dEntity;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user