改进RenderBoundBox范例

This commit is contained in:
2025-07-07 01:28:22 +08:00
parent e021f30877
commit 13f4332af1
2 changed files with 12 additions and 10 deletions

2
CMCore

Submodule CMCore updated: 25060b07d0...8e733a2415

View File

@@ -33,8 +33,6 @@ class TestApp:public WorkObject
{ {
private: private:
struct MaterialData struct MaterialData
{ {
Material * material = nullptr; Material * material = nullptr;
@@ -56,6 +54,8 @@ private:
MeshComponentData *data; MeshComponentData *data;
ComponentDataPtr cdp; ComponentDataPtr cdp;
MeshComponent *component;
public: public:
~RenderMesh() ~RenderMesh()
@@ -201,8 +201,8 @@ private:
{ {
struct TorusCreateInfo tci; struct TorusCreateInfo tci;
tci.innerRadius=0.975; tci.innerRadius=0.9;
tci.outerRadius=1.0; tci.outerRadius=1.1;
tci.numberSlices=64; tci.numberSlices=64;
tci.numberStacks=8; tci.numberStacks=8;
@@ -233,14 +233,14 @@ private:
{ {
cci.mat=scale(10,10,1); cci.mat=scale(10,10,1);
CreateComponent<MeshComponent>(&cci,rm_plane->cdp); rm_plane->component=CreateComponent<MeshComponent>(&cci,rm_plane->cdp);
} }
{ {
//cci.mat=rotate(90,AxisVector::Y); cci.mat=AxisYRotate(deg2rad(90));
cci.mat=Identity4f;
auto *mc=CreateComponent<MeshComponent>(&cci,rm_torus->cdp); rm_torus->component=CreateComponent<MeshComponent>(&cci,rm_torus->cdp);
mc->SetOverrideMaterial(solid.mi[1]); rm_torus->component->SetOverrideMaterial(solid.mi[1]);
} }
return(true); return(true);
@@ -250,6 +250,8 @@ private:
{ {
CreateComponentInfo cci(GetSceneRoot()); CreateComponentInfo cci(GetSceneRoot());
cci.mat=rm_torus->component->GetLocalMatrix();
CreateComponent<MeshComponent>(&cci,rm_box->cdp); CreateComponent<MeshComponent>(&cci,rm_box->cdp);
CameraControl *camera_control=GetCameraControl(); CameraControl *camera_control=GetCameraControl();