Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oss release v1.4.4 created 2024-03-15-09-03 #63

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# master
# v1.4.4

# Unreleased
**FIXED**

* SkinBinding serializing inverse binding matrices in wrong order

**CHANGED**

* Upgrade ramses from 27.0.130 to 27.0.139
* ramses-logic-viewer script improvements:
* scene is flushed when `rlogic.update()` is called from script
* added optional sleep parameter (milliseconds) to `rlogic.update()`

# v1.4.3

**FIXED**

* Patched missing include in sol v3.2.2

# v1.4.2

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cmake_minimum_required(VERSION 3.13)

set(RLOGIC_VERSION_MAJOR 1)
set(RLOGIC_VERSION_MINOR 4)
set(RLOGIC_VERSION_PATCH 2)
set(RLOGIC_VERSION_PATCH 4)

set(RLOGIC_VERSION ${RLOGIC_VERSION_MAJOR}.${RLOGIC_VERSION_MINOR}.${RLOGIC_VERSION_PATCH})
set(ramses-logic_VERSION "${RLOGIC_VERSION}" CACHE STRING "Ramses Logic version" FORCE)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ existing files exported with Logic Engine version **W** or newer (Binary file co

|Logic | Included Ramses version | Minimum required Ramses version | Binary file compatibility |
|----------|-------------------------------|------------------------------------|------------------------------|
|v1.4.4 | 27.0.139 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 |
|v1.4.3 | 27.0.130 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 |
|v1.4.2 | 27.0.130 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 |
|v1.4.1 | 27.0.128 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 |
|v1.4.0 | 27.0.126 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cd test-cmake.config

SET PATH=%INSTALL_DIR%/bin;%PATH%

cmake -G%CMAKE_GENERATOR% -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" --build test-cmake.config %SCRIPT_DIR%/shared-lib-check/
cmake -G%CMAKE_GENERATOR% -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" %SCRIPT_DIR%/shared-lib-check/
cmake --build . --config %BUILD_CONFIG% --target run-all

::check for errors
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ alabaster==0.7.12
attrs==21.2.0
Babel==2.9.1
breathe==4.18.1
certifi==2020.12.5
certifi==2022.12.7
chardet==4.0.0
docutils==0.16
idna==2.10
Expand Down
23 changes: 23 additions & 0 deletions doc/sphinx/viewer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ Options

Instructs the renderer to apply multisampling (Valid values: 1, 2, 4, 8)

.. option:: --clear-color R G B A

Sets the display clear color to other than the default black (e.g.: :code:`ramses-logic-viewer --clear-color 0 0.5 0.8 1`)

.. option:: --write-config [filename]

Writes the default lua configuration to the given filename. If the filename is omitted, the viewer will use
Expand All @@ -108,11 +112,18 @@ Logic Nodes

The module ``rlogic`` provides members to access all Logic Node types:

* ``rlogic.interfaces`` (:cpp:class:`rlogic::LuaInterface`)
* ``rlogic.scripts`` (:cpp:class:`rlogic::LuaScript`)
* ``rlogic.animationNodes`` (:cpp:class:`rlogic::AnimationNode`)
* ``rlogic.timerNodes`` (:cpp:class:`rlogic::TimerNode`)
* ``rlogic.nodeBindings`` (:cpp:class:`rlogic::RamsesNodeBinding`)
* ``rlogic.appearanceBindings`` (:cpp:class:`rlogic::RamsesAppearanceBinding`)
* ``rlogic.cameraBindings`` (:cpp:class:`rlogic::RamsesCameraBinding`)
* ``rlogic.renderPassBindings`` (:cpp:class:`rlogic::RamsesRenderPassBinding`)
* ``rlogic.renderGroupBindings`` (:cpp:class:`rlogic::RamsesRenderGroupBinding`)
* ``rlogic.meshNodeBindings`` (:cpp:class:`rlogic::RamsesMeshNodeBinding`)
* ``rlogic.anchorPoints`` (:cpp:class:`rlogic::AnchorPoint`)
* ``rlogic.skinBindings`` (:cpp:class:`rlogic::SkinBinding`)

The Logic Node instances can be either found by name or by object id.
Alternatively the node list can be iterated.
Expand Down Expand Up @@ -258,3 +269,15 @@ the logic engine state by calling ``rlogic.update()``:
if not rlogic.scripts.foo.OUT.color.value == {255, 0, 0} then
error("unexpected value")
end

``rlogic.update()`` has an optional integer parameter that takes a time value in milliseconds.
If the parameter is set to a non-zero value, ``rlogic.update()`` will sleep for the given amount of time.
This can be useful to avoid high CPU load, if the batch script needs to wait for an expected value change.

.. code-block:: lua

rlogic.scripts.foo.IN.color.value = "red"

while not rlogic.scripts.foo.OUT.color.value == {255, 0, 0} do
rlogic.update(16)
end
2 changes: 1 addition & 1 deletion external/ramses
Submodule ramses updated 226 files
2 changes: 1 addition & 1 deletion lib/impl/SkinBindingImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace rlogic::internal
for (const auto& mat : skinBinding.m_inverseBindMatrices)
{
const auto matData = mat.toStdArray();
inverseBindMatData.insert(inverseBindMatData.begin(), matData.cbegin(), matData.cend());
inverseBindMatData.insert(inverseBindMatData.end(), matData.cbegin(), matData.cend());
}
const auto fbInverseBindMatData = builder.CreateVector(inverseBindMatData);

Expand Down
11 changes: 10 additions & 1 deletion tools/ramses-logic-viewer/LogicViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "LogicViewer.h"
#include "LogicViewerLuaTypes.h"
#include "LogicViewerLog.h"
#include "ramses-client-api/Scene.h"
#include "ramses-logic/LogicEngine.h"
#include "ramses-logic/AnimationNode.h"
#include "ramses-logic/TimerNode.h"
Expand All @@ -27,6 +28,7 @@
#include "internals/SolHelper.h"
#include <iostream>
#include <fstream>
#include <thread>

namespace rlogic
{
Expand Down Expand Up @@ -129,6 +131,7 @@ namespace rlogic

bool LogicViewer::loadRamsesLogic(const std::string& filename, ramses::Scene* scene)
{
m_scene = scene;
m_logicFilename = filename;
return m_logicEngine.loadFromFile(filename, scene);
}
Expand Down Expand Up @@ -205,7 +208,11 @@ namespace rlogic
return m_screenshotFunc(screenshotFile);
},
ltnUpdate,
[&]() { updateEngine(); },
[&](uint32_t sleepMs = 0) {
updateEngine();
if (sleepMs != 0)
std::this_thread::sleep_for(std::chrono::milliseconds(sleepMs));
},
ltnLink,
[&](const ConstPropertyWrapper& src, const PropertyWrapper& target) { return m_logicEngine.link(src.m_property, target.m_property); },
ltnUnlink,
Expand Down Expand Up @@ -312,6 +319,8 @@ namespace rlogic
void LogicViewer::updateEngine()
{
m_logicEngine.update();
if (m_scene)
m_scene->flush();
if (m_updateReportEnabled)
{
m_updateReportSummary.add(m_logicEngine.getLastUpdateReport());
Expand Down
1 change: 1 addition & 0 deletions tools/ramses-logic-viewer/LogicViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ namespace rlogic
void load(sol::load_result&& loadResult);

rlogic::LogicEngine m_logicEngine;
ramses::Scene* m_scene = nullptr;
ScreenshotFunc m_screenshotFunc;
std::string m_logicFilename;
std::string m_luaFilename;
Expand Down
1 change: 0 additions & 1 deletion tools/ramses-logic-viewer/LogicViewerGuiApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ namespace rlogic
if (isRunning)
{
const auto updateStatus = m_viewer->update();
m_scene->flush();
m_imguiHelper->dispatchEvents();
ImGui::NewFrame();
m_gui->draw();
Expand Down
58 changes: 48 additions & 10 deletions tools/ramses-logic-viewer/test/LogicViewerLuaTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ namespace rlogic::internal
IN.paramInt64_2 = Type:Int64()
IN.paramFloat = Type:Float()
IN.paramFloat_2 = Type:Float()
IN.paramFloat_3 = Type:Float()
IN.paramString = Type:String()
IN.paramVec2f = Type:Vec2f()
IN.paramVec3f = Type:Vec3f()
Expand All @@ -59,6 +58,9 @@ namespace rlogic::internal
data2 = Type:Int32()
}
}
IN.anchorData1 = Type:Vec2f()
IN.anchorData2 = Type:Float()

OUT.paramBool = Type:Bool()
OUT.paramInt32 = Type:Int32()
OUT.paramInt64 = Type:Int64()
Expand All @@ -77,6 +79,8 @@ namespace rlogic::internal
data2 = Type:Int32()
}
}
OUT.anchorData1 = Type:Vec2f()
OUT.anchorData2 = Type:Float()
end
function run(IN,OUT)
OUT.paramBool = not IN.paramBool
Expand All @@ -93,6 +97,8 @@ namespace rlogic::internal
OUT.array = {10,20,30,44,50}
OUT.struct.nested.data1 = IN.paramString
OUT.struct.nested.data2 = IN.paramInt32
OUT.anchorData1 = IN.anchorData1
OUT.anchorData2 = IN.anchorData2
end
)", {}, "foo");

Expand Down Expand Up @@ -165,11 +171,13 @@ namespace rlogic::internal
*script->getOutputs()->getChild("paramFloat"),
*cameraBinding->getInputs()->getChild("frustum")->getChild("leftPlane"));

// use weak link because of circular dependency. The link has no meaning, it is just
// needed to make the setup valid (fee of dangling content)
// use weak link because of circular dependency
engine.linkWeak(
*anchor->getOutputs()->getChild("viewportCoords"),
*script->getInputs()->getChild("anchorData1"));
engine.linkWeak(
*anchor->getOutputs()->getChild("depth"),
*script->getInputs()->getChild("paramFloat_3"));
*script->getInputs()->getChild("anchorData2"));

engine.update();

Expand Down Expand Up @@ -844,8 +852,29 @@ namespace rlogic::internal

TEST_F(ALogicViewerLua, anchorPointByName)
{
auto* coords = getOutput<rlogic::AnchorPoint>("foo", "viewportCoords");
EXPECT_TRUE(coords);
// unlink anchor from script inputs so that we can overwrite values
unlinkInput(*getInput<rlogic::LuaScript>("foo", "anchorData1"));
unlinkInput(*getInput<rlogic::LuaScript>("foo", "anchorData2"));

// first overwrite with some dummy values to 'reset' them
EXPECT_EQ(Result(), loadLua(R"(
rlogic.scripts.foo.IN.anchorData1.value = { 1, 2 }
rlogic.scripts.foo.IN.anchorData2.value = 3
)"));
auto* outScript = getNode<rlogic::LuaScript>("foo");
EXPECT_FLOAT_EQ(1.f, GetOutput(outScript, "anchorData1")->get<vec2f>().value()[0]);
EXPECT_FLOAT_EQ(2.f, GetOutput(outScript, "anchorData1")->get<vec2f>().value()[1]);
EXPECT_FLOAT_EQ(3.f, GetOutput(outScript, "anchorData2")->get<float>().value());

// now access values from anchor point and assign them to script inputs, overwriting the dummy values from before
EXPECT_EQ(Result(), loadLua(R"(
rlogic.scripts.foo.IN.anchorData1.value = { rlogic.anchorPoints.foo.OUT.viewportCoords.value[1], rlogic.anchorPoints.foo.OUT.viewportCoords.value[2] }
rlogic.scripts.foo.IN.anchorData2.value = rlogic.anchorPoints.foo.OUT.depth.value
)"));

EXPECT_FLOAT_EQ(0.f, GetOutput(outScript, "anchorData1")->get<vec2f>().value()[0]);
EXPECT_FLOAT_EQ(8.f, GetOutput(outScript, "anchorData1")->get<vec2f>().value()[1]);
EXPECT_FLOAT_EQ(-0.01010102f, GetOutput(outScript, "anchorData2")->get<float>().value());
}

TEST_F(ALogicViewerLua, interfaceById)
Expand Down Expand Up @@ -964,10 +993,19 @@ namespace rlogic::internal

TEST_F(ALogicViewerLua, anchorPointById)
{
auto* node = getNode<rlogic::AnchorPoint>("foo");
ASSERT_EQ(8u, node->getId());
auto* ticker = GetOutput(node, "viewportCoords");
EXPECT_TRUE(ticker);
// unlink anchor from script inputs so that we can overwrite values
unlinkInput(*getInput<rlogic::LuaScript>("foo", "anchorData1"));
unlinkInput(*getInput<rlogic::LuaScript>("foo", "anchorData2"));

EXPECT_EQ(Result(), loadLua(R"(
rlogic.scripts.foo.IN.anchorData1.value = { rlogic.anchorPoints[8].OUT.viewportCoords.value[1], rlogic.anchorPoints[8].OUT.viewportCoords.value[2] }
rlogic.scripts.foo.IN.anchorData2.value = rlogic.anchorPoints[8].OUT.depth.value
)"));

auto* outScript = getNode<rlogic::LuaScript>("foo");
EXPECT_FLOAT_EQ(0.f, GetOutput(outScript, "anchorData1")->get<vec2f>().value()[0]);
EXPECT_FLOAT_EQ(8.f, GetOutput(outScript, "anchorData1")->get<vec2f>().value()[1]);
EXPECT_FLOAT_EQ(-0.01010102f, GetOutput(outScript, "anchorData2")->get<float>().value());
}

TEST_F(ALogicViewerLua, animationNodeById)
Expand Down
45 changes: 45 additions & 0 deletions unittests/api/SkinBindingTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,51 @@ namespace rlogic::internal
EXPECT_NEAR(expectedMat2[i], mat2[i], 1e-4f) << i;
}

TEST_F(ASkinBinding, CalculatesSameValuesAfterLoadingFromFile)
{
WithTempDirectory tmpDir;

m_jointNodes[0]->setRotation(1.f, 2.f, 3.f);
m_jointNodes[1]->setTranslation(-1.f, -2.f, -3.f);
EXPECT_TRUE(m_logicEngine.update());
EXPECT_TRUE(m_logicEngine.saveToFile("tmp.logic"));
// change to dummy values in shared scene
const std::array<float, 32u> dummyData{ 0.f };
m_appearance->setInputValueMatrix44f(m_uniform, 2u, dummyData.data());

// load from file, update and expect unfiforms matching original values
LogicEngine loadedLogic{ m_logicEngine.getFeatureLevel() };
EXPECT_TRUE(loadedLogic.loadFromFile("tmp.logic", m_scene));
EXPECT_TRUE(loadedLogic.update());

const matrix44f expectedMat1 = {
0.998f, -0.0523f, 0.0349f, 0.f,
0.0529f, 0.9984f, -0.0174f, 0.f,
-0.0339f, 0.01925f, 0.9992f, 0.f,
-0.00209f, -0.00235f, 0.00227f, 1.f
};
const matrix44f expectedMat2 = {
1.f, 0.f, 0.f, 0.f,
0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 0.f,
-1.f, -2.f, -3.f, 1.f
};

std::array<float, 32u> uniformData{};
m_appearance->getInputValueMatrix44f(m_uniform, 2u, uniformData.data());

matrix44f mat1{};
matrix44f mat2{};
std::copy(uniformData.cbegin(), uniformData.cbegin() + 16u, mat1.begin());
std::copy(uniformData.cbegin() + 16u, uniformData.cend(), mat2.begin());

for (size_t i = 0u; i < 16u; ++i)
EXPECT_NEAR(expectedMat1[i], mat1[i], 1e-4f) << i;

for (size_t i = 0u; i < 16u; ++i)
EXPECT_NEAR(expectedMat2[i], mat2[i], 1e-4f) << i;
}

class ASkinBinding_SerializationLifecycle : public ASkinBinding
{
protected:
Expand Down
Loading