Comments (16)
I would've guessed that std::array
had a constexpr equality operator by C++17 but seems i guessed wrong.
Removing constexpr
in edyn::matrix3x3::operator==
should be the easiest fix, but std::array<T>::operator[]
is constexpr so you can compare all the rows manually.
from edyn.
Another thing: edyn::matrix3x3::column(_dot)
shouldn't be constexpr since they use edyn::vector3::operator[]
.
Overnight on my part, my bad.
from edyn.
Closing this as the exception I am getting is separate from the original issue.
from edyn.
That looks like a more fundamental problem which is likely not related to the shared_components tuple. More information is needed. Are you linking the library (static or dynamic?) against your own application?
from edyn.
I am linking statically against my own application ( 64 bit )
entt::registry reg;
int main(void)
{
edyn::init();
edyn::attach(reg);
auto def = edyn::rigidbody_def();
def.kind = edyn::rigidbody_kind::rb_dynamic;
def.position = { 0, 3, 0 };
def.orientation = edyn::quaternion_axis_angle({ 0, 1, 0 }, edyn::to_radians(30));
def.linvel = edyn::vector3_zero;
def.angvel = { 0, 0.314, 0 };
def.mass = 50;
def.shape = edyn::box_shape{ 0.5, 0.2, 0.4 }; // Shape is optional.
def.update_inertia();
def.material->restitution = 0.2; // Material is also optional.
def.material->friction = 0.9;
def.gravity = edyn::gravity_earth;
auto entity = edyn::make_rigidbody(reg, def);
while (1)
{
edyn::update(reg);
auto rigid_bodies = reg.view<edyn::present_position, edyn::present_orientation>();
for (auto rb : rigid_bodies)
{
auto& pp = rigid_bodies.get<edyn::present_position>(rb);
auto& po = rigid_bodies.get<edyn::present_orientation>(rb);
std::cout << "pos: (" << pp.x << ',' << pp.y << ',' << pp.z << ") ori: " << edyn::quaternion_angle(po) << "\n";
}
}
return 0;
}
from edyn.
It looks alright. I can't give any additional advice without more information.
from edyn.
It appears that shared_components is getting initialized multiple times, it crashes on the second initialization. I am still trying to figure out why.
from edyn.
Hmm interesting... shared_components
is declared as static const
in a header. That might be a problem... I will have to investigate.
from edyn.
I have pushed some changes to master
. Let me know if that fixes it.
from edyn.
I have a ton of errors trying to build master regarding the matrix3x3 class
edyn/math/matrix3x3.hpp(25,23): error C3615: constexpr function 'edyn::matrix3x3::column' cannot result in a constant expression
edyn/math/matrix3x3.hpp(26,25): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(26,25): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(26,36): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(26,36): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(26,47): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(26,47): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(29,22): error C3615: constexpr function 'edyn::matrix3x3::column_dot' cannot result in a constant expression
edyn/math/matrix3x3.hpp(30,24): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(30,24): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(30,42): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(30,42): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(30,60): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(30,60): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(101,16): error C3615: constexpr function 'edyn::operator ==' cannot result in a constant expression
edyn/math/matrix3x3.hpp(102,18): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(102,18): message : see usage of 'std::operator =='
edyn/math/matrix3x3.hpp(106,16): error C3615: constexpr function 'edyn::operator !=' cannot result in a constant expression
edyn/math/matrix3x3.hpp(107,18): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(107,18): message : see usage of 'std::operator !='
edyn/math/matrix3x3.hpp(149,21): error C3615: constexpr function 'edyn::inverse_matrix_symmetric' cannot result in a constant expression
edyn/math/matrix3x3.hpp(150,5): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(150,5): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(150,5): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(150,5): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(151,5): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(151,5): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(151,5): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(151,5): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(152,5): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(152,5): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(152,5): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(152,5): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(158,22): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(158,22): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(158,37): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(158,37): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(158,52): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(158,52): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(159,22): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(159,22): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(159,37): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(159,37): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(160,22): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(160,22): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(164,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(164,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(165,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(165,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(166,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(166,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(168,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(168,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(168,29): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(168,29): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(169,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(169,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(170,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(170,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(172,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(172,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(172,29): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(172,29): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(173,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(173,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(173,29): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(173,29): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(174,15): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(174,15): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(188,19): error C3615: constexpr function 'edyn::get_diagonal' cannot result in a constant expression
edyn/math/matrix3x3.hpp(189,19): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(189,19): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(189,28): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(189,28): message : see usage of 'edyn::vector3::operator []'
edyn/math/matrix3x3.hpp(189,37): message : failure was caused by call of undefined function or one not declared 'constexpr'
edyn/math/matrix3x3.hpp(189,37): message : see usage of 'edyn::vector3::operator []'
from edyn.
If declare the vector3 array operators as constexpr
constexpr scalar& operator[](size_t i) noexcept {
EDYN_ASSERT(i < 3);
return (&x)[i];
}
constexpr scalar operator[](size_t i) const noexcept {
EDYN_ASSERT(i < 3);
return (&x)[i];
}
I get it down to 2 errors:
math/matrix3x3.hpp(101,16): error C3615: constexpr function 'edyn::operator ==' cannot result in a constant expression
math/matrix3x3.hpp(102,18): message : failure was caused by call of undefined function or one not declared 'constexpr'
math/matrix3x3.hpp(102,18): message : see usage of 'std::operator =='
math/matrix3x3.hpp(106,16): error C3615: constexpr function 'edyn::operator !=' cannot result in a constant expression
math/matrix3x3.hpp(107,18): message : failure was caused by call of undefined function or one not declared 'constexpr'
math/matrix3x3.hpp(107,18): message : see usage of 'std::operator !='
from edyn.
@StellaSmith do you think this is caused by the std::array
equality operator? As it is not constexpr before C++20 https://en.cppreference.com/w/cpp/container/array/operator_cmp and it is used in theedyn::matrix3x3
equality operator. It could be replaced by an individual comparison between row vectors.
from edyn.
@RallyTronics let me know if the latest commit changes anything.
from edyn.
The vector3 array operator [] is still not constexpr so I still get a ton of errors. If I declare those as constexpr it builds correctly. I no longer get the stack-based buffer overrun error. It now crashes in make_rigidbody() here:
if (def.presentation && def.kind == rigidbody_kind::rb_dynamic) {
registry.emplace<present_position>(entity, def.position);
registry.emplace<present_orientation>(entity, def.orientation);
}
I get an exception on the
registry.emplace<present_position>(entity, def.position);
line. I am still digging.
from edyn.
Exception occurs here in delegate.hpp
/**
* @brief Triggers a delegate.
*
* The delegate invokes the underlying function and returns the result.
*
* @warning
* Attempting to trigger an invalid delegate results in undefined
* behavior.
*
* @param args Arguments to use to invoke the underlying function.
* @return The value returned by the underlying function.
*/
Ret operator()(Args... args) const {
ENTT_ASSERT(static_cast<bool>(*this), "Uninitialized delegate");
return fn(data, std::forward<Args>(args)...);
}
from edyn.
I get the same exception when running the hello_world example.
from edyn.
Related Issues (20)
- double precision HOT 1
- Unable to build in VS2019 HOT 2
- Update Conan to use Edyn 1.1.0 & ENTT 3.10.3 HOT 1
- Collision Failure between Dynamic and Static Entity HOT 2
- error compiling Edyn using latest entt:x64-windows from vcpkg.io HOT 1
- compile issue HOT 1
- edyn::detach doesn't properly cleanup added systems
- make_rigidbody shape is not optional HOT 1
- add on_destroy_aabb in broadphase to allow detaching/changing shapes of a rigidbody. HOT 13
- registry_operation does not preserve the order of operations in async mode compared to the same operations in sync HOT 2
- A lot of warnings when building with msvc HOT 1
- Crash when destroying a rigidbody entity. HOT 4
- Issue with rigidbody_set_kind HOT 1
- set_rigidbody_kind issue still happening
- attach/detach issue HOT 3
- rigidbody_set_kind in async mode HOT 1
- Crash `Assertion `is_power_of_two(mod)' failed.`
- Add ability to select capsule axis HOT 3
- Having difficulty compiling (clang on linux) HOT 4
- `error: call to non-‘constexpr’ function ‘edyn::vector3 ` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edyn.