Skip to content

Commit

Permalink
Oss release master created 2021-12-15-22-38
Browse files Browse the repository at this point in the history
see CHANGELOG.md for details

Original commit sha: 34679a1f886a9303608340d7446f366c7b1654ad

Co-authored-by: Daniel Haas <25718295+bojackHaasman@users.noreply.github.com>
Co-authored-by: Tobias Hammer <tohammer@users.noreply.github.com>
Co-authored-by: Bernhard Kisslinger <65217745+bkisslinger@users.noreply.github.com>
Co-authored-by: Violin Yanev <violinyanev@users.noreply.github.com>
  • Loading branch information
5 people committed Dec 15, 2021
1 parent 0e3eb06 commit c4f0529
Show file tree
Hide file tree
Showing 185 changed files with 8,511 additions and 4,080 deletions.
14 changes: 0 additions & 14 deletions .ansible-lint

This file was deleted.

6 changes: 3 additions & 3 deletions .gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ line-length=160
# it in the commit message.
# files=gitlint/rules.py,README.md

# [soft-body-max-line-length]
# line-length=80
[soft-body-max-line-length]
line-length=160

# [body-match-regex]
# python like regex (https://docs.python.org/2/library/re.html) that the
# commit-msg body must be matched to.
# regex=(?i)ISSUE-[0-9]*
# regex=(?i)ISSUE-[0-9]*
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[submodule "external/ramses"]
url = https://github.com/GENIVI/ramses.git
url = https://github.com/COVESA/ramses.git
path = external/ramses
[submodule "external/googletest"]
url = https://github.com/google/googletest.git
Expand Down
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
# master

# v0.13.0

Summary:
* Major performance improvement for large scenes with lots of links alongside few bugfixes
* New Ramses (27.0.114)
* Not backwards compatible
* binary files need re-export

**API Changes**

* Removed LuaScript::overrideLuaPrint
* Logic engine has better means for debugging since this was introduced
* Overriding built-in Lua print was a security threat and also violated sandboxing
* If you still want to get string data out of scripts, just create a string property and read it out
* Can't modify module data any more (this was a technical debt which was fixed in this release)
* Added a built-in methods to make it easier to work with custom types from C++
* 'rl_len' to get the size of ramses logic built-in types and modules from inside Lua
* 'rl_next' to create and increment stateless iterators for custom types similar to standard next()
* 'rl_pairs' and 'rl_ipairs' to iterate custom types similar to standard pairs() and ipairs()
* See the [Lua docs](https://ramses-logic.readthedocs.io/en/latest/lua_syntax.html#custom-functions) for more info
* Added unique (in the scope of one Logic Engine) and immutable Logic Object Id that will be automatically assigned on object creation.
*Object Ids start at 1 and are counted upwards for new objects.
* Added convenience method LogicEngine::findLogicObjectById(id) to find object with id regardless of its type
* Added LogicEngineReport, LogicEngine::enableUpdateReport, LogicEngine::getLastUpdateReport which collects statistics about updated nodes.
* Added PropertyEnumToType traits to be able to obtain a C++ data type of a property (inverse of EPropertyTypeToEnum)
* Added TimerNode which is a new logic node to handle timing information for AnimationNode and scripts
* All LogicEngine collection getters and finders were replaced with templated versions:
* LogicEngine::scripts() -> LogicEngine::getCollection<LuaScript>
LogicEngine::ramsesNodeBindings() -> LogicEngine::getCollection<RamsesNodeBinding>()
...
* LogicEngine::findScript(name) -> LogicEngine::findByName<LuaScript>(name)
LogicEngine::findNodeBinding(name) -> LogicEngine::findByName<RamsesNodeBinding>(name)
...

**Features**

* Added EPropertyType::Int64 (INT64 in Lua) property type to represent 64bit signed integer in logic network
* Also added INT32 Lua interface property which is equivalent to INT (INT is kept and act as alias for INT32)
* Animation begin and end can be modified by setting AnimationNode 'timeRange' input property.
* Added Update Report (statistics about updated nodes) to ramses-logic-viewer
* Large scenes with many links now don't cause unnecessary CPU usage when input data didn't change
* Link updates are generally faster after major rework of link handling

**Bugfixes**

* Fixed bug where ramses bindings re-applied their values to ramses when linked, even though the value didn't change
* It's now possible to access array elements by index in interface()
* Improved error messages when converting numeric types. Errors now contain info why the conversion failed,
i.e. because of numeric rounding, silent truncation, negative numbers etc.. Also works for arrays and VECx types
* Fixed bug in the viewer program where default settings were not exported correctly
* Property::isLinked() works for outputs too, not just inputs
* Linking/unlinking errors contain more useful information

# v0.12.0

**API Changes**
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 3.13)
#==========================================================================

set(RLOGIC_VERSION_MAJOR 0)
set(RLOGIC_VERSION_MINOR 12)
set(RLOGIC_VERSION_MINOR 13)
set(RLOGIC_VERSION_PATCH 0)

set(RLOGIC_VERSION ${RLOGIC_VERSION_MAJOR}.${RLOGIC_VERSION_MINOR}.${RLOGIC_VERSION_PATCH})
Expand All @@ -24,7 +24,7 @@ project(RamsesLogic
VERSION ${RLOGIC_VERSION}
DESCRIPTION "A scripting and animation runtime for Ramses based on Lua"
LANGUAGES CXX
HOMEPAGE_URL "https://github.com/GENIVI/ramses-logic"
HOMEPAGE_URL "https://github.com/COVESA/ramses-logic"
)

#==========================================================================
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Introduction


[![build status](https://github.com/GENIVI/ramses-logic/workflows/CMake/badge.svg?branch=master)](https://github.com/GENIVI/ramses-logic/actions?query=branch%3Amaster) [![docs status](https://readthedocs.org/projects/ramses-logic/badge/?style=flat)](https://ramses-logic.readthedocs.io/en/latest/)
[![build status](https://github.com/COVESA/ramses-logic/workflows/CMake/badge.svg?branch=master)](https://github.com/COVESA/ramses-logic/actions?query=branch%3Amaster) [![docs status](https://readthedocs.org/projects/ramses-logic/badge/?style=flat)](https://ramses-logic.readthedocs.io/en/latest/)

`RAMSES logic` extends the [RAMSES rendering ecosystem](https://ramses-sdk.readthedocs.io/) with scripting support based on
[Lua](https://github.com/lua/lua). `RAMSES` is designed to be minimalistic and closely aligned to OpenGL, which can be a
Expand All @@ -16,7 +16,7 @@ You can find the full documentation of `RAMSES logic` [here](https://ramses-logi
Clone RAMSES logic along with its dependencies:

```bash
$ git clone https://github.com/GENIVI/ramses-logic <path>
$ git clone https://github.com/COVESA/ramses-logic <path>
$ cd <path>
$ git submodule update --init --recursive
```
Expand All @@ -34,20 +34,21 @@ Prefer to learn by example? Have a look at our [self-contained example snippets]

|Logic | Included Ramses version | Minimum required Ramses version | Binary file compatibility |
|---------|-------------------------------|------------------------------------|------------------------------|
|0.12.0 | 27.0.113 | same as 0.6.0 | 0.9.x |
|0.11.0 | 27.0.113 | same as 0.6.0 | 0.9.x |
|0.10.2 | 27.0.112 | same as 0.6.0 | 0.9.x |
|0.10.1 | 27.0.111 | same as 0.6.0 | 0.9.x |
|0.10.0 | 27.0.111 | same as 0.6.0 | 0.9.x |
|0.9.1 | 27.0.111 | same as 0.6.0 | 0.9.x |
|0.9.0 | 27.0.110 | same as 0.6.0 | 0.9.x |
|0.8.1 | 27.0.110 | same as 0.6.0 | 0.7.x or 0.8.x |
|0.8.0 | 27.0.110 | same as 0.6.0 | 0.7.x or 0.8.x |
|0.7.0 | 27.0.105 | same as 0.6.0 | 0.7.x |
|0.6.2 | 27.0.105 | same as 0.6.0 | 0.6.x |
|0.6.1 | 27.0.103 (includes 27.0.11) | same as 0.6.0 | 0.6.x |
|0.13.0 | 27.0.114 | 27.0.102 | >= 0.13.0 |
|0.12.0 | 27.0.113 | 27.0.102 | 0.9.0 - 0.12.0 |
|0.11.0 | 27.0.113 | 27.0.102 | 0.9.0 - 0.12.0 |
|0.10.2 | 27.0.112 | 27.0.102 | 0.9.0 - 0.12.0 |
|0.10.1 | 27.0.111 | 27.0.102 | 0.9.0 - 0.12.0 |
|0.10.0 | 27.0.111 | 27.0.102 | 0.9.0 - 0.12.0 |
|0.9.1 | 27.0.111 | 27.0.102 | 0.9.0 - 0.12.0 |
|0.9.0 | 27.0.110 | 27.0.102 | 0.9.0 - 0.12.0 |
|0.8.1 | 27.0.110 | 27.0.102 | 0.7.x or 0.8.x |
|0.8.0 | 27.0.110 | 27.0.102 | 0.7.x or 0.8.x |
|0.7.0 | 27.0.105 | 27.0.102 | 0.7.x |
|0.6.2 | 27.0.105 | 27.0.102 | 0.6.x |
|0.6.1 | 27.0.103 (includes 27.0.11) | 27.0.102 | 0.6.x |
|0.6.0 | 27.0.102 (includes 27.0.10) | 27.0.100 | 0.6.x |
|0.5.3 | 27.0.101 | 27.0.100 | 0.5.x |
|0.5.3 | 27.0.101 | 27.0.100 | 0.5.3 |

# License

Expand Down
166 changes: 166 additions & 0 deletions benchmarks/animation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
// -------------------------------------------------------------------------
// Copyright (C) 2021 BMW AG
// -------------------------------------------------------------------------
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// -------------------------------------------------------------------------

#include "benchmark/benchmark.h"

#include "ramses-logic/LogicEngine.h"
#include "ramses-logic/LuaScript.h"
#include "ramses-logic/Property.h"
#include "ramses-logic/AnimationNode.h"
#include "ramses-logic/AnimationTypes.h"
#include "fmt/format.h"

namespace rlogic
{
const auto animationIterations = 100;

static void RunAnimation(LogicEngine& logicEngine, benchmark::State& state, Property* timeProp)
{
while (state.KeepRunning())
{
auto i = animationIterations;
while ((i--) != 0)
{
timeProp->set(0.015f);
if (!logicEngine.update())
{
state.SkipWithError("failure running update()");
}
}
}
}

static void RunScript(benchmark::State& state, const std::string& src)
{
LogicEngine logicEngine;
LuaConfig config;
config.addStandardModuleDependency(EStandardModule::Base);
auto* script = logicEngine.createLuaScript(src, config);
if (!script)
{
state.SkipWithError("Script creation failed");
return;
}
auto* timeProp = script->getInputs()->getChild("time");

while (state.KeepRunning())
{
auto i = animationIterations;
float time = 0.0f;
while ((i--) != 0)
{
time += 0.015f;
timeProp->set(time);
if (!logicEngine.update())
{
state.SkipWithError("failure running update()");
}
}
}
}

static void BM_AnimationScriptLinear(benchmark::State& state)
{
const std::string src = fmt::format(R"(
function interface()
IN.time = FLOAT
OUT.value = VEC3F
end
function run()
for i = 0,{},1 do
z = 360 * IN.time / 1.5
OUT.value = {{0, 0, z}}
end
end
)", state.range(0));
RunScript(state, src);
}

static void BM_AnimationScriptKeyframes(benchmark::State& state)
{
const std::string src = fmt::format(R"(
function interface()
IN.time = FLOAT
OUT.value = VEC3F
end
function run()
for i = 0,{},1 do
GLOBAL.pos = IN.time
if GLOBAL.pos < 0.5 then
z = 360 * GLOBAL.pos / 0.5
elseif GLOBAL.pos < 1.0 then
z = 180 - 80 * (GLOBAL.pos - 0.5) / 1.0
elseif GLOBAL.pos < 1.5 then
z = 100 + 260 * (GLOBAL.pos - 1) / 0.5
end
OUT.value = {{0, 0, z}}
end
end
)", state.range(0));
RunScript(state, src);
}

static void BM_AnimationLinear(benchmark::State& state)
{
LogicEngine logicEngine;
const auto* animTimestamps = logicEngine.createDataArray(std::vector<float>{ 0.f, 1.5f }); // will be interpreted as seconds
const auto* animKeyframes = logicEngine.createDataArray(std::vector<rlogic::vec3f>{ {0.f, 0.f, 0.f}, {0.f, 0.f, 360.f} });
const rlogic::AnimationChannel channelLinear { "rotationZ", animTimestamps, animKeyframes, rlogic::EInterpolationType::Linear };

AnimationChannels channels(state.range(0), channelLinear);
auto* node = logicEngine.createAnimationNode(channels);
node->getInputs()->getChild("play")->set(true);
node->getInputs()->getChild("loop")->set(true);
auto* timeProp = node->getInputs()->getChild("timeDelta");

RunAnimation(logicEngine, state, timeProp);
}

static void BM_AnimationKeyframes(benchmark::State& state)
{
LogicEngine logicEngine;
const auto* animTimestamps = logicEngine.createDataArray(std::vector<float>{ 0.f, 0.5f, 1.f, 1.5f }); // will be interpreted as seconds
const auto* animKeyframes = logicEngine.createDataArray(std::vector<rlogic::vec3f>{ {0.f, 0.f, 0.f}, {0.f, 0.f, 180.f}, {0.f, 0.f, 100.f}, {0.f, 0.f, 360.f} });
const rlogic::AnimationChannel channelLinear { "rotationZ", animTimestamps, animKeyframes, rlogic::EInterpolationType::Linear };

AnimationChannels channels(state.range(0), channelLinear);
auto* node = logicEngine.createAnimationNode(channels);
node->getInputs()->getChild("play")->set(true);
node->getInputs()->getChild("loop")->set(true);
auto* timeProp = node->getInputs()->getChild("timeDelta");

RunAnimation(logicEngine, state, timeProp);
}

static void BM_AnimationKeyframesCubic(benchmark::State& state)
{
LogicEngine logicEngine;
const auto* animTimestamps = logicEngine.createDataArray(std::vector<float>{ 0.f, 0.5f, 1.f, 1.5f }); // will be interpreted as seconds
const auto* animKeyframes = logicEngine.createDataArray(std::vector<rlogic::vec3f>{ {0.f, 0.f, 0.f}, {0.f, 0.f, 180.f}, {0.f, 0.f, 100.f}, {0.f, 0.f, 360.f} });
const auto* cubicAnimTangentsIn = logicEngine.createDataArray(std::vector<rlogic::vec3f>{ {0.f, 0.f, 0.f}, { 0.f, 0.f, 0.f }, { 0.f, 0.f, 0.f }, { 0.f, 0.f, 0.f } });
const auto* cubicAnimTangentsOut = logicEngine.createDataArray(std::vector<rlogic::vec3f>{ {0.f, 0.f, 0.f}, { 0.f, 0.f, 0.f }, { 0.f, 0.f, 0.f }, { 0.f, 0.f, 0.f } });
const rlogic::AnimationChannel channelCubic { "rotationZcubic", animTimestamps, animKeyframes, rlogic::EInterpolationType::Cubic, cubicAnimTangentsIn, cubicAnimTangentsOut };

AnimationChannels channels(state.range(0), channelCubic);
auto* node = logicEngine.createAnimationNode(channels);
node->getInputs()->getChild("play")->set(true);
node->getInputs()->getChild("loop")->set(true);
auto* timeProp = node->getInputs()->getChild("timeDelta");

RunAnimation(logicEngine, state, timeProp);
}

// Compares animation objects with animations done in lua
// ARG: number of animation channels
BENCHMARK(BM_AnimationScriptLinear)->Arg(1)->Arg(10);
BENCHMARK(BM_AnimationScriptKeyframes)->Arg(1)->Arg(10);
BENCHMARK(BM_AnimationLinear)->Arg(1)->Arg(10);
BENCHMARK(BM_AnimationKeyframes)->Arg(1)->Arg(10);
BENCHMARK(BM_AnimationKeyframesCubic)->Arg(1)->Arg(10);
}

9 changes: 6 additions & 3 deletions benchmarks/compile_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@

namespace rlogic
{
static void CompileLua(LogicEngine& logicEngine, std::string_view src)
static void CompileLua(LogicEngine& logicEngine, std::string_view src, const LuaConfig& config)
{
LuaScript* script = logicEngine.createLuaScript(src);
LuaScript* script = logicEngine.createLuaScript(src, config);
logicEngine.destroy(*script);
}

static void BM_CompileLua_Interface(benchmark::State& state)
{
LogicEngine logicEngine;

LuaConfig config;
config.addStandardModuleDependency(EStandardModule::Base);

const int64_t scriptSize = state.range(0);

const std::string scriptSrc = fmt::format(R"(
Expand All @@ -38,7 +41,7 @@ namespace rlogic

for (auto _ : state) // NOLINT(clang-analyzer-deadcode.DeadStores) False positive
{
CompileLua(logicEngine, scriptSrc);
CompileLua(logicEngine, scriptSrc, config);
}
}

Expand Down
Loading

0 comments on commit c4f0529

Please sign in to comment.