Giter Site home page Giter Site logo

Comments (3)

moebiussurfing avatar moebiussurfing commented on August 11, 2024 2

Hey @LUK3D , @nariakiiwatani

I think that the problem is here:
image

Bc is getting the viewport rectangle from ImGui but there's no ImGui window, so I switched to get the viewport from OF.

image

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.

nariakiiwatani avatar nariakiiwatani commented on August 11, 2024 2

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.

moebiussurfing avatar moebiussurfing commented on August 11, 2024 1

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.