Logrus
Topic Author
Posts: 52
Joined: 22 Jul 2015, 12:16

ProjectMatrix for control

04 Dec 2021, 10:36

Hi,
How can I set the Project matrix for the control (like Canvas)?

Setting a common Project matrix for IView doesn't suit me.

Have an idea to implement a custom FrameworkElement but not sure if this solution will work:
class Viewport3D : public Noesis::FrameworkElement
{
	using Base = Noesis::FrameworkElement;
public:
	void OnRender(Noesis::DrawingContext* drawingContext) override
	{
		PushProjMatrix(); //store current proj matrix for Iview
		SetProjMatrix(mViewProjMatrix); //set proj matrix for control
		Base::OnRender(drawingContext);
		PopProjMatrix();
	}
	//////
	// override some other methods...
	/////
};
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: ProjectMatrix for control

06 Dec 2021, 12:46

If you want to position a control in 3D you can use the Transform3D property.
In code you can set that property directly in any UIElement:
Ptr<CompositeTransform3D> transform = *new CompositeTransform3D();
transform->SetRotationX(30.0f);
element->SetTransform3D(transform);
Is that what you are looking for?
 
Logrus
Topic Author
Posts: 52
Joined: 22 Jul 2015, 12:16

Re: ProjectMatrix for control

06 Dec 2021, 13:22

Unfortunately no,
I am using multiple Viewports,
so for each Viewport it will be necessary to calculate and store copies WorldViewProjMatrix , instead of one
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: ProjectMatrix for control

06 Dec 2021, 15:13

Views only support a single ProjectionMatrix (at the root). If you need more than one, I think you can use several views.
 
Logrus
Topic Author
Posts: 52
Joined: 22 Jul 2015, 12:16

Re: ProjectMatrix for control

06 Dec 2021, 16:01

my 3d elements are interactive,
and the Main and 3d IView overlap
in this case, there will be problems with management display events
Attachments
View+View3D.JPG
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: ProjectMatrix for control

06 Dec 2021, 16:54

I don't think you need a projection matrix for that. As Sergio explained, Transform3D can be used to position UI element in 3D space.

Only one projection matrix can be used per view.
 
Logrus
Topic Author
Posts: 52
Joined: 22 Jul 2015, 12:16

Re: ProjectMatrix for control

07 Dec 2021, 14:17

thanks

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 58 guests