added Windows instructions to rename sdk folder, adjusted in vcxproj, removed using namespace for bella

This commit is contained in:
Harvey Fong 2025-03-15 08:31:12 -06:00
parent 967b0c287e
commit 19312d8461
3 changed files with 75 additions and 73 deletions

View File

@ -16,7 +16,7 @@ workdir/
└── poomer-raylib-bella_onimage/ └── poomer-raylib-bella_onimage/
``` ```
Download SDK for your OS and drag bella_engine_sdk into your workdir Download SDK for your OS and drag bella_engine_sdk into your workdir. On Windows rename unzipped folder by removing version ie bella_engine_sdk-24.6.0 -> bella_engine_sdk
- [bella_engine_sdk MacOS](https://downloads.bellarender.com/bella_engine_sdk-24.6.0.dmg) - [bella_engine_sdk MacOS](https://downloads.bellarender.com/bella_engine_sdk-24.6.0.dmg)
- [bella_engine_sdk Linux](https://downloads.bellarender.com/bella_engine_sdk-24.6.0.tar.gz) - [bella_engine_sdk Linux](https://downloads.bellarender.com/bella_engine_sdk-24.6.0.tar.gz)

View File

@ -20,8 +20,10 @@
#include "bella_sdk/bella_engine.h" #include "bella_sdk/bella_engine.h"
#include "dl_core/dl_fs.h" #include "dl_core/dl_fs.h"
using namespace dl; //using namespace dl;
using namespace dl::bella_sdk; //using namespace dl::bella_sdk;
namespace bsdk = dl::bella_sdk;
// Create namespace aliases for raylib types that conflict with bella_sdk // Create namespace aliases for raylib types that conflict with bella_sdk
namespace rl { namespace rl {
@ -100,7 +102,7 @@ private:
float orbitSpeed = 0.5f; float orbitSpeed = 0.5f;
float panSpeed = 0.01f; float panSpeed = 0.01f;
rl::Vector2 prevMousePos = {0, 0}; rl::Vector2 prevMousePos = {0, 0};
Engine* engine = nullptr; // Reference to the bella engine for camera control bsdk::Engine* engine = nullptr; // Reference to the bella engine for camera control
// Store initial camera state for reset functionality // Store initial camera state for reset functionality
bool hasInitialCamera = false; bool hasInitialCamera = false;
@ -138,7 +140,7 @@ public:
} }
// Set the engine reference for camera control // Set the engine reference for camera control
void setEngine(Engine* engineRef) { void setEngine(bsdk::Engine* engineRef) {
engine = engineRef; engine = engineRef;
// Mark that we have an initial camera state // Mark that we have an initial camera state
@ -330,11 +332,11 @@ public:
float wheelMove = rl::GetMouseWheelMove(); float wheelMove = rl::GetMouseWheelMove();
if (wheelMove != 0.0f) { if (wheelMove != 0.0f) {
if (engine && engine->rendering()) { if (engine && engine->rendering()) {
Scene::EventScope eventScope(engine->scene()); bsdk::Scene::EventScope eventScope(engine->scene());
// Create a Vec2 with y component only for dolly effect // Create a Vec2 with y component only for dolly effect
Vec2 dollyDelta; dl::Vec2 dollyDelta;
dollyDelta.y = wheelMove * 0.8; dollyDelta.y = wheelMove * 0.8;
bella_sdk::zoomCamera( engine->scene().cameraPath(), dollyDelta, true ); bsdk::zoomCamera( engine->scene().cameraPath(), dollyDelta, true );
} }
} }
@ -425,9 +427,9 @@ public:
// Only orbit if there's actual movement // Only orbit if there's actual movement
if (deltaX != 0.0f || deltaY != 0.0f) { if (deltaX != 0.0f || deltaY != 0.0f) {
// Create a Vec2 for the delta (using bella_sdk's Vec2) // Create a Vec2 for the delta (using bsdk's Vec2)
// Fix: Initialize Vec2 properly according to its API // Fix: Initialize Vec2 properly according to its API
Vec2 delta; dl::Vec2 delta;
delta.x = deltaX; delta.x = deltaX;
delta.y = deltaY; delta.y = deltaY;
@ -437,9 +439,9 @@ public:
// This collects all scene changes within this scope and applies them together // This collects all scene changes within this scope and applies them together
// when the eventScope object is destroyed at the end of this block. // when the eventScope object is destroyed at the end of this block.
// It improves performance and ensures consistency of multiple scene changes. // It improves performance and ensures consistency of multiple scene changes.
Scene::EventScope eventScope(engine->scene()); bsdk::Scene::EventScope eventScope(engine->scene());
// Use the bella_sdk namespace to avoid ambiguity with Path // Use the bsdk namespace to avoid ambiguity with Path
bella_sdk::orbitCamera(engine->scene().cameraPath(), delta); bsdk::orbitCamera(engine->scene().cameraPath(), delta);
} }
// Update previous position for next frame // Update previous position for next frame
@ -457,8 +459,8 @@ public:
// Only pan if there's actual movement // Only pan if there's actual movement
if (deltaX != 0.0f || deltaY != 0.0f) { if (deltaX != 0.0f || deltaY != 0.0f) {
// Create a Vec2 for the delta (using bella_sdk's Vec2) // Create a Vec2 for the delta (using bsdk's Vec2)
Vec2 delta; dl::Vec2 delta;
delta.x = deltaX; delta.x = deltaX;
delta.y = deltaY; delta.y = deltaY;
@ -467,8 +469,8 @@ public:
// This collects all scene changes within this scope and applies them together // This collects all scene changes within this scope and applies them together
// when the eventScope object is destroyed at the end of this block. // when the eventScope object is destroyed at the end of this block.
// It improves performance and ensures consistency of multiple scene changes. // It improves performance and ensures consistency of multiple scene changes.
Scene::EventScope eventScope(engine->scene()); bsdk::Scene::EventScope eventScope(engine->scene());
bella_sdk::panCamera(engine->scene().cameraPath(), delta, true); bsdk::panCamera(engine->scene().cameraPath(), delta, true);
} }
// Update previous position for next frame // Update previous position for next frame
@ -499,29 +501,29 @@ public:
// Forward declaration // Forward declaration
class PathTracerPreview; class PathTracerPreview;
// Custom engine observer that connects bella_sdk's Image to our PathTracerPreview // Custom engine observer that connects bsdk's Image to our PathTracerPreview
struct BellaEngineObserver : public EngineObserver { struct BellaEngineObserver : public bsdk::EngineObserver {
private: private:
PathTracerPreview* preview; PathTracerPreview* preview;
public: public:
BellaEngineObserver(PathTracerPreview* preview) : preview(preview) {} BellaEngineObserver(PathTracerPreview* preview) : preview(preview) {}
void onStarted(String pass) override { void onStarted(dl::String pass) override {
//logInfo("Started pass %s", pass.buf()); //logInfo("Started pass %s", pass.buf());
} }
void onStatus(String pass, String status) override { void onStatus(dl::String pass, dl::String status) override {
//logInfo("%s [%s]", status.buf(), pass.buf()); //logInfo("%s [%s]", status.buf(), pass.buf());
} }
void onProgress(String pass, Progress progress) override { void onProgress(dl::String pass, bsdk::Progress progress) override {
//logInfo("%s [%s]", progress.toString().buf(), pass.buf()); //logInfo("%s [%s]", progress.toString().buf(), pass.buf());
} }
// This is the key method that receives images from the bella engine // This is the key method that receives images from the bella engine
// IMPORTANT: This method is called from the bella engine's thread, NOT the main thread // IMPORTANT: This method is called from the bella engine's thread, NOT the main thread
void onImage(String pass, dl::bella_sdk::Image image) override { void onImage(dl::String pass, bsdk::Image image) override {
//logInfo("Received image from bella: %d x %d", (int)image.width(), (int)image.height()); //logInfo("Received image from bella: %d x %d", (int)image.width(), (int)image.height());
// Get the dimensions of the image // Get the dimensions of the image
@ -539,7 +541,7 @@ public:
// Get the raw RGBA data pointer - rgba8() returns Rgba8* (RgbaT<unsigned char>*) // Get the raw RGBA data pointer - rgba8() returns Rgba8* (RgbaT<unsigned char>*)
// No mutex needed as the developers confirmed the data survives within this callback // No mutex needed as the developers confirmed the data survives within this callback
Rgba8* rgba_data = image.rgba8(); dl::Rgba8* rgba_data = image.rgba8();
if (!rgba_data) { if (!rgba_data) {
std::cerr << "ERROR: rgba8() returned NULL" << std::endl; std::cerr << "ERROR: rgba8() returned NULL" << std::endl;
@ -575,17 +577,17 @@ public:
} }
} }
void onError(String pass, String msg) override { void onError(dl::String pass, dl::String msg) override {
//logError("%s [%s]", msg.buf(), pass.buf()); //logError("%s [%s]", msg.buf(), pass.buf());
} }
void onStopped(String pass) override { void onStopped(dl::String pass) override {
//logInfo("Stopped %s", pass.buf()); //logInfo("Stopped %s", pass.buf());
} }
}; };
#include "dl_core/dl_main.inl" #include "dl_core/dl_main.inl"
int DL_main(Args& args) int DL_main(dl::Args& args)
{ {
try { try {
SetTraceLogLevel(LOG_ERROR); SetTraceLogLevel(LOG_ERROR);
@ -608,7 +610,7 @@ int DL_main(Args& args)
//std::cout << "OpenGL context initialized" << std::endl; //std::cout << "OpenGL context initialized" << std::endl;
// Initialize the bella engine // Initialize the bella engine
Engine engine; bsdk::Engine engine;
engine.scene().loadDefs(); engine.scene().loadDefs();
engine.enableInteractiveMode(); engine.enableInteractiveMode();
engine.enableDisplayTransform(); engine.enableDisplayTransform();
@ -621,21 +623,21 @@ int DL_main(Args& args)
engine.subscribe(&engineObserver); engine.subscribe(&engineObserver);
// Get the preview scene with material sphere // Get the preview scene with material sphere
auto path = bella_sdk::previewPath(); auto path = bsdk::previewPath();
if (path != "") { if (path != "") {
//std::cout << "Loading scene: " << path.buf() << std::endl; //std::cout << "Loading scene: " << path.buf() << std::endl;
//logInfo("Loading scene: %s", path.buf()); //logInfo("Loading scene: %s", path.buf());
// Use the read method to load the scene // Use the read method to load the scene
if (!engine.scene().read(path)) { if (!engine.scene().read(path)) {
std::cerr << "ERROR: Failed to read " << path.buf() << " from " << fs::currentDir().buf() << std::endl; std::cerr << "ERROR: Failed to read " << path.buf() << " from " << dl::fs::currentDir().buf() << std::endl;
logError("Failed to read %s from %s", path.buf(), fs::currentDir().buf()); dl::logError("Failed to read %s from %s", path.buf(), dl::fs::currentDir().buf());
return 1; return 1;
} }
if (!engine.start()) { if (!engine.start()) {
std::cerr << "ERROR: Engine failed to start" << std::endl; std::cerr << "ERROR: Engine failed to start" << std::endl;
logError("Engine failed to start."); dl::logError("Engine failed to start.");
return 1; return 1;
} }

View File

@ -47,7 +47,7 @@
<PreprocessorDefinitions>PSEUDODEBUG;_CONSOLE;DL_USE_SHARED;NOMINMAX;WIN32_LEAN_AND_MEAN;NOGDI;NOUSER;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>PSEUDODEBUG;_CONSOLE;DL_USE_SHARED;NOMINMAX;WIN32_LEAN_AND_MEAN;NOGDI;NOUSER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion> <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\bella_engine_sdk-24.6.0\src;..\raylib\src;..\raygui\src</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\bella_engine_sdk\src;..\raylib\src;..\raygui\src</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -64,14 +64,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>false</SDLCheck> <SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;DL_USE_SHARED;NOMINMAX;WIN32_LEAN_AND_MEAN;NOGDI;NOUSER;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_CONSOLE;DL_USE_SHARED;NOMINMAX;WIN32_LEAN_AND_MEAN;NOGDI;NOUSER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\bella_engine_sdk-24.6.0\src;..\raylib\src;..\raygui\src</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\bella_engine_sdk\src;..\raylib\src;..\raygui\src</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>lib;..\raylib\build\raylib\Release;..\bella_engine_sdk-24.6.0\lib</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>lib;..\raylib\build\raylib\Release;..\bella_engine_sdk\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>bella_engine_sdk.lib;raylib.lib;Shlwapi.lib;vulkan-1.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>bella_engine_sdk.lib;raylib.lib;Shlwapi.lib;vulkan-1.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>vulkan-1.dll</DelayLoadDLLs> <DelayLoadDLLs>vulkan-1.dll</DelayLoadDLLs>
</Link> </Link>
@ -90,50 +90,50 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<PostBuildEvent> <PostBuildEvent>
<Command>echo Post-build event started &amp; <Command>echo Post-build event started &amp;
copy "$(ProjectDir)..\bella_engine_sdk-24.6.0\lib\bella_engine_sdk.dll" "$(TargetDir)" &amp; copy "$(ProjectDir)..\bella_engine_sdk\lib\bella_engine_sdk.dll" "$(TargetDir)" &amp;
echo bella_engine_sdk.dll copied &amp; echo bella_engine_sdk.dll copied &amp;
copy "$(ProjectDir)..\bella_engine_sdk-24.6.0\lib\dl_core.dll" "$(TargetDir)" &amp; copy "$(ProjectDir)..\bella_engine_sdk\lib\dl_core.dll" "$(TargetDir)" &amp;
echo dl_core.dll copied &amp; echo dl_core.dll copied &amp;
copy "$(ProjectDir)..\bella_engine_sdk-24.6.0\lib\dl_oidn_core.dll" "$(TargetDir)" &amp; copy "$(ProjectDir)..\bella_engine_sdk\lib\dl_oidn_core.dll" "$(TargetDir)" &amp;
echo dl_oidn_core.dll copied &amp; echo dl_oidn_core.dll copied &amp;
echo Post-build event finished</Command> echo Post-build event finished</Command>
</PostBuildEvent> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\bella_sdk\api.h" /> <ClInclude Include="..\bella_engine_sdk\src\bella_sdk\api.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\bella_sdk\bella_engine.h" /> <ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_engine.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\bella_sdk\bella_nodeapi.h" /> <ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_nodeapi.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\bella_sdk\bella_scene.h" /> <ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_scene.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\bella_sdk\bella_sceneapi.h" /> <ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_sceneapi.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\bella_sdk\bella_types.h" /> <ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_types.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\api.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\api.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_args.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_args.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_array.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_array.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_compress.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_compress.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_defines.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_defines.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_file.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_file.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_fs.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_fs.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_hash.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_hash.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_hashmap.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_hashmap.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_hw.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_hw.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_licensing.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_licensing.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_logging.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_logging.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_main.inl" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_main.inl" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_math.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_math.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_nullable.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_nullable.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_os.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_os.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_path.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_path.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_pcgrng.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_pcgrng.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_platform.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_platform.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_references.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_references.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_refvector.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_refvector.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_string.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_string.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_stringio.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_stringio.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_time.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_time.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_topomap.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_topomap.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_types.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_types.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_vector.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_vector.h" />
<ClInclude Include="..\bella_engine_sdk-24.6.0\src\dl_core\dl_version.h" /> <ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_version.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="poomer-raylib-bella_onimage.cpp" /> <ClCompile Include="poomer-raylib-bella_onimage.cpp" />
@ -144,7 +144,7 @@
<None Include="makefile" /> <None Include="makefile" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Library Include="..\bella_engine_sdk-24.6.0\lib\bella_engine_sdk.lib" /> <Library Include="..\bella_engine_sdk\lib\bella_engine_sdk.lib" />
<Library Include="..\raylib\build\raylib\Release\raylib.lib" /> <Library Include="..\raylib\build\raylib\Release\raylib.lib" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>