32 lines
891 B
C++
32 lines
891 B
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 "V3dViewer.h"
|
|
|
|
#ifndef NATIVE_TAG
|
|
#define NATIVE_TAG "VIEWER"
|
|
#endif
|
|
#include <V3d_DirectionalLight.hxx>
|
|
#include <V3d_AmbientLight.hxx>
|
|
namespace NativeOpenCAX {
|
|
|
|
V3dViewer::V3dViewer() : viewer(nullptr) {}
|
|
V3dViewer::~V3dViewer() {}
|
|
|
|
bool V3dViewer::InitV3dViewer(Handle(OpenGl_GraphicDriver)& graphicDriver) {
|
|
try {
|
|
viewer = new V3d_Viewer(graphicDriver);
|
|
viewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
|
|
viewer->SetDefaultLights();
|
|
viewer->SetLightOn();
|
|
HILOG_INFO(NATIVE_TAG, "InitViewer Done");
|
|
return true;
|
|
} catch (std::exception &e) {
|
|
HILOG_INFO(NATIVE_TAG, "InitViewer Fail:%{public}d", e.what());
|
|
return false;
|
|
}
|
|
}
|
|
} |