OpenCAX/entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.cpp
JackLee 406cd03b02 增加两个模型
修改世界坐标系
测试鼠标旋转相机
2026-03-07 18:46:12 +08:00

40 lines
1.4 KiB
C++

//
// Created on 2026/3/6.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".
#include "WorldAxis.h"
#ifndef NATIVE_TAG
#define NATIVE_TAG "InitWorldAxis"
#endif
namespace NativeOpenCAX {
bool InitWorldAxis(RenderOption& opt) {
if (opt.worldAxisPlacement.IsNull()) {
// 添加世界坐标系(左下角)
opt.worldAxisPlacement = new Geom_Axis2Placement(gp::XOY());
opt.worldAxis = new AIS_Trihedron(opt.worldAxisPlacement);
opt.worldAxis->SetSize(100.0); // 小一点,作为指示器
opt.worldAxis->SetZLayer(Graphic3d_ZLayerId_TopOSD);
opt.worldAxis->SetTransformPersistence(
new Graphic3d_TransformPers(
Graphic3d_TMF_2d, // 2D 模式
Aspect_TOTP_LEFT_LOWER, // 左下角对齐
Graphic3d_Vec2i(100, 100) // 偏移量(像素)
)
);
opt.worldAxis->SetDatumPartColor(Prs3d_DP_XAxis,Quantity_NOC_RED);
opt.worldAxis->SetDatumPartColor(Prs3d_DP_YAxis,Quantity_NOC_GREEN);
opt.worldAxis->SetDatumPartColor(Prs3d_DP_ZAxis,Quantity_NOC_BLUE);
opt.context->Display(opt.worldAxis, 0, 0, false);
HILOG_INFO(NATIVE_TAG,"InitWorldAxis Done");
return true;
}
return false;
}
void ChangeWorldAxis() {
}
}