Comments (3)
Hey @LUK3D , @nariakiiwatani
I think that the problem is here:
Bc is getting the viewport rectangle from ImGui but there's no ImGui window, so I switched to get the viewport from OF.
void ofApp::draw() {
cam_.begin();
{
//node_.draw();
ofPushMatrix();
{
node_.transformGL(); // Applies the node's transformation matrix
ofPushStyle();
ofNoFill();
ofDrawBox(25);
ofPopStyle();
}
ofPopMatrix();
}
cam_.end();
//--
gui_.begin();
{
ImGuizmo::BeginFrame();
auto mat = node_.getLocalTransformMatrix();
if (ImGuizmo::Manipulate(cam_, mat, op_, mode_)) {
glm::mat4 transformation;
glm::vec3 scale;
glm::quat rotation;
glm::vec3 translation;
glm::vec3 skew;
glm::vec4 perspective;
glm::decompose(mat, scale, rotation, translation, skew, perspective);
node_.setPosition(translation);
node_.setScale(scale);
node_.setOrientation(rotation);
}
}
gui_.end();
}
from ofximguizmo.
Thank you for everything!
so good, so nice!
for the viewport problem, I fixed it by getting viewport from ofCamera. ( be0e0ce )
When I made this addon, I have used it inside ImWindow so the rectangle was implicitly same to oF viewport.
for simpler API, I think what @moebiussurfing wanted to do is essentially same to my second Manipulate
functionality.
https://github.com/nariakiiwatani/ofxImGuizmo/blob/main/src/ofxImGuizmo.h#L55-L62
I fixed the example using this. ( 9caba8b )
from ofximguizmo.
You can check my modified fork, also with a new example that uses OF helpers:
https://github.com/moebiussurfing/ofxImGuizmo/blob/main/example-ImGuizmo/src/ofApp.cpp
Now the API is more simpler:
cam_.begin();
{
//node_.draw();
// Applies the node's transformation matrix
ImGuizmo::beginGuizmoTransform(&node_);
{
ofPushStyle();
ofNoFill();
ofDrawBox(25);
ofPopStyle();
}
ImGuizmo::endGuizmoTransform();
}
cam_.end();
ImGuizmo::drawImGuizmo(&gui_, &cam_, &node_, op_, mode_);
from ofximguizmo.
Related Issues (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 ofximguizmo.