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:
parent
d29d40448b
commit
ff5a590cf4
@ -170,6 +170,14 @@ public class MainRunner {
|
||||
PythonWriter.writeAccVal("dest/CK_BITMAPDATA_FLAGS.AccVal.py", single);
|
||||
CSharpWriter.writeAccVal("dest/CK_BITMAPDATA_FLAGS.AccVal.cs", single);
|
||||
|
||||
single = organiseDefines("src/CK_CAMERA_PROJECTION.txt", "CK_CAMERA_PROJECTION");
|
||||
CppWriter.writeEnum("dest/CK_CAMERA_PROJECTION.hpp", single);
|
||||
PythonWriter.writeEnum("dest/CK_CAMERA_PROJECTION.py", single);
|
||||
CSharpWriter.writeEnum("dest/CK_CAMERA_PROJECTION.cs", single);
|
||||
CppWriter.writeAccVal("dest/CK_CAMERA_PROJECTION.AccVal.hpp", single, CommonHelper.CKParts.CK2);
|
||||
PythonWriter.writeAccVal("dest/CK_CAMERA_PROJECTION.AccVal.py", single);
|
||||
CSharpWriter.writeAccVal("dest/CK_CAMERA_PROJECTION.AccVal.cs", single);
|
||||
|
||||
// print message.
|
||||
System.out.println("DONE!");
|
||||
}
|
||||
|
4
CodeGen/EnumsMigration/src/CK_CAMERA_PROJECTION.txt
Normal file
4
CodeGen/EnumsMigration/src/CK_CAMERA_PROJECTION.txt
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
#define CK_PERSPECTIVEPROJECTION 1
|
||||
|
||||
#define CK_ORTHOGRAPHICPROJECTION 2
|
@ -41,6 +41,25 @@ typedef enum VX_PIXELFORMAT {
|
||||
_4_ARGB8888_CLUT = 31 // 4 bits indexed CLUT (ARGB)
|
||||
} VX_PIXELFORMAT;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
{filename:VXLIGHT_TYPE}
|
||||
Summary: Light type.
|
||||
|
||||
Remarks:
|
||||
+ Used by CKLight::SetType to specify the type of a light.
|
||||
See also: CKLight::SetType,CKLight::GetType
|
||||
******************************************************************/
|
||||
typedef enum VXLIGHT_TYPE
|
||||
{
|
||||
VX_LIGHTPOINT = 1UL, // The Light is a point of light
|
||||
VX_LIGHTSPOT = 2UL, // The light is a spotlight
|
||||
VX_LIGHTDIREC = 3UL, // The light is directional light : Lights comes from an infinite point so only direction of light can be given
|
||||
VX_LIGHTPARA = 4UL // Obsolete, do not use
|
||||
} VXLIGHT_TYPE;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
{filename:VXTEXTURE_BLENDMODE}
|
||||
Summary: Blend Mode Flags
|
||||
|
@ -256,4 +256,9 @@ namespace LibCmo::CK2 {
|
||||
CKBITMAPDATA_DYNAMIC = 64,
|
||||
};
|
||||
|
||||
enum class CK_CAMERA_PROJECTION : CKDWORD {
|
||||
CK_PERSPECTIVEPROJECTION = 1,
|
||||
CK_ORTHOGRAPHICPROJECTION = 2,
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,10 @@
|
||||
#include "ObjImpls/CKTexture.hpp"
|
||||
#include "ObjImpls/CKMaterial.hpp"
|
||||
#include "ObjImpls/CKMesh.hpp"
|
||||
#include "ObjImpls/CKLight.hpp"
|
||||
#include "ObjImpls/CKTargetLight.hpp"
|
||||
#include "ObjImpls/CKCamera.hpp"
|
||||
#include "ObjImpls/CKTargetCamera.hpp"
|
||||
|
||||
namespace LibCmo::CK2 {
|
||||
|
||||
@ -439,6 +443,10 @@ CKClassRegister(cid, parentCid, \
|
||||
EasyClassReg(ObjImpls::CKTexture, CK_CLASSID::CKCID_TEXTURE, CK_CLASSID::CKCID_BEOBJECT, "Texture");
|
||||
EasyClassRegWithNotify(ObjImpls::CKMaterial, CK_CLASSID::CKCID_MATERIAL, CK_CLASSID::CKCID_BEOBJECT, "Material", { CK_CLASSID::CKCID_TEXTURE });
|
||||
EasyClassRegWithNotify(ObjImpls::CKMesh, CK_CLASSID::CKCID_MESH, CK_CLASSID::CKCID_BEOBJECT, "Mesh", { CK_CLASSID::CKCID_MATERIAL });
|
||||
EasyClassReg(ObjImpls::CKLight, CK_CLASSID::CKCID_LIGHT, CK_CLASSID::CKCID_3DENTITY, "Light");
|
||||
EasyClassReg(ObjImpls::CKCamera, CK_CLASSID::CKCID_CAMERA, CK_CLASSID::CKCID_3DENTITY, "Camera");
|
||||
EasyClassRegWithNotify(ObjImpls::CKTargetLight, CK_CLASSID::CKCID_TARGETLIGHT, CK_CLASSID::CKCID_LIGHT, "Target Light", { CK_CLASSID::CKCID_3DENTITY });
|
||||
EasyClassRegWithNotify(ObjImpls::CKTargetCamera, CK_CLASSID::CKCID_TARGETCAMERA, CK_CLASSID::CKCID_CAMERA, "Target Camera", { CK_CLASSID::CKCID_3DENTITY });
|
||||
|
||||
#undef EasyClassReg
|
||||
#undef EasyClassRegWithNotify
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -45,6 +45,21 @@ namespace LibCmo::VxMath {
|
||||
_4_ARGB8888_CLUT = 31, /**< 4 bits indexed CLUT (ARGB) */
|
||||
};
|
||||
|
||||
/**
|
||||
{filename:VXLIGHT_TYPE}
|
||||
Summary: Light type.
|
||||
|
||||
Remarks:
|
||||
+ Used by CKLight::SetType to specify the type of a light.
|
||||
See also: CKLight::SetType,CKLight::GetType
|
||||
*/
|
||||
enum class VXLIGHT_TYPE : CKDWORD {
|
||||
VX_LIGHTPOINT = 1UL, /**< The Light is a point of light */
|
||||
VX_LIGHTSPOT = 2UL, /**< The light is a spotlight */
|
||||
VX_LIGHTDIREC = 3UL, /**< The light is directional light : Lights comes from an infinite point so only direction of light can be given */
|
||||
VX_LIGHTPARA = 4UL, /**< Obsolete, do not use */
|
||||
};
|
||||
|
||||
/**
|
||||
Summary: Blend Mode Flags
|
||||
Remarks:
|
||||
|
Loading…
Reference in New Issue
Block a user