Comments (4)
From user's point of view I'd appreciate more solution 1.1. I find differentiating between general shapes and physics shapes bit confusing. Ideally user should be able to pass general shape and let framework decide (at compile time) whether it is related to debug drawing, collision detection, physics computation etc. depending on context. But I have no idea about implementation.
Could you please describe issue with ShapeGroup
in 1.1?
from magnum.
Thoughts:
- Algebraic structure like Monoids for shapes
- encapsulate single shape or shape group
- provide
%
and composition operators - result: no specific (at least public) type to differentiate "primitive" from "composition of primitives"
- issues: how to specify position of components in composition
- I like the idea with splitting
Physics
namespace- maybe
Shapes
andPhysics
- Where does "I'd like to render a box!" fit? Is it a primitive or a shape? What about "I'd like to render a box and make it collidable as fast as possible to see if my game idea works."?
- maybe
from magnum.
- this is how it is currently -
ShapeGroup
which can contain one or more shapes, but the only advantage is the "universal" type, querying the contents is almost impossible. The shapes actually behave like monoids and you have to specify the type only during creation of single shapes, not for the result:
auto shape = Physics::Point2D({}) || Physics::Sphere2D({3.0f, 1.0f}, 0.5f);
Nice thing would be to have something like the following to avoid specifying the resulting type altogether to follow the monoids idea, maybe C++17 will be able to do it?:
new Shapes::Shape<auto>(object, shape);
Otherwise, to avoid explicit type specification, we must resort to some makeShape()
function as described above.
2. Shapes
and Physics
, sure.
In current "terminology", primitive is mesh data (vertices, faces, normals...) of some basic object (circle, line, arrow, crosshair, monkey...) to ease up prototyping, shape is (simplified) description of some subspace (which doesn't even need to encapsulate any mesh, e.g. trigger volumes) used for collision detection (primarily not for rendering). User's line of thoughs should be like this:
- I'd like to have a box object:
auto box = new Object3D(scene);
- I'd like to have it collidable, thus I need to assign
Shape
feature to it and somehow describe its erm... shape, possibly usingShapes::Box3D
:
auto shape = new Shapes::Shape<???>(box, Shapes::Box3D(...));
- I'd like to visualize the box somehow. I have two options, assign
Drawable
feature to it and render a mesh (possibly created from pre-madePrimitives::Cube
) using some shader (possibly with stockShaders::Phong
). Or, because I have assigned the collision shape already, I can useDebugTools::ShapeRenderer
, which will visualize just the shape with wireframe, it will look ugly, but I can do it better later:
new DebugTools::ShapeRenderer3D(shape, ...);
from magnum.
Done in 06d707f.
from magnum.
Related Issues (20)
- few compile warnings HOT 1
- How to point to a local installation of `corrade` without using the bootstrap project? HOT 3
- undefined symbol: flextGLInit HOT 4
- Image rendered in gray since 1847c72 HOT 18
- Emscripten 3.1.21+ crashes EmscriptenApplication: "AsciiToString is not defined" HOT 4
- How to build from source on MSYS2 MINGW64? HOT 1
- keyReleaseEvent not triggered after printscreen on OSX HOT 6
- Conversion from CubicHermite to Bezier is wrong
- Mixing with raw openGL calls and Context::current().resetState() HOT 3
- C Bindings HOT 5
- WebGPU backend HOT 2
- Parallel rendering with glb files HOT 5
- Conflict with near and far Macros When Including WinSock2.h After Matrix4.h HOT 2
- emsdk compile error: typedef redefinition with different types HOT 4
- Memory leak when destroying GL::Mesh HOT 3
- Linking in Emscripten >= 3.1.52 doesn't work HOT 4
- Some trouble with LineGL3D shader when camera is close HOT 1
- Segmentation fault with nullptr instruction in AbstractShaderProgram at Cross-Compile HOT 21
- Apply MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS for the flextGL globals as well HOT 4
- EmscriptenApplication keyboard handler doesn't send key event corresponding to text input events 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 magnum.