Vortex - Camera Picking and Project

JaviCervera

Member
3rd Party Module Dev
Joined
Jul 12, 2017
Messages
81
Thanks again. I have added your code to my fork of Vortex at
Which will become the backend for our official 3D module.
When you say that Vortex will be the backend for the 3D module, do you mean that you want to add a layer on top of it with a different API? If that's the case, then we could take a different (and probably cleaner) approach: I could simplify Vortex to handle the lower level stuff, and you can integrate that with your API, with the entity / material / etc API that you like.
 
Last edited:

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
2,988
@MikeHart would you like me to merge your and innerloop's changes to main Vortex repo and continue working from there?

@JaviCervera of course, that would be great. If you would accept PRs on yours that would be awesome.

One thing you could look at , if oyu have time for it, is the LookAt command. Did I made a mistake there? Also, I have implemented methods for loading OBJ and B3D-Files directly. With B3D, it doesn't load the animation but static files so far are fine. It seems that I don't have the calculation of normals correct. A mesh doesn't look the same like when you first convert it with your meshtool.

When you say that Vortex will be the backend for the 3D module, do you mean that you want to add a layer on top of it with a different API?

Kinda like that. But I would not change Vortex for this. I am more after something to make it less wordy. For an example...
code_language.cerberus:
floorObj = New Model(Mesh.CreateQuad(New Material(Texture.Load("environment/Tile1.png"))))

could be simpolified with

code_language.cerberus:
floorObj = CreatePlane("environment/Tile1.png")

Things like that.
 

innerloop

New member
CX Code Contributor
Joined
Jan 18, 2021
Messages
8
@JaviCervera
Great news :)
@MikeHart
For LookAt like in Blitz3D use this code:

[CODE lang="cerberus" title="add this to class Entity inside file "entity.cxs""]
Method LookAt:Void( targetPoint:Float[3], rollAngle:Float = 0.0 )
Local dirX := targetPoint[0] - mPosition[0]
Local dirY := targetPoint[1] - mPosition[1]
Local dirZ := targetPoint[2] - mPosition[2]
mRotation[0] = -ATan2( dirY, Sqrt( dirX * dirX + dirZ * dirZ ) )
mRotation[1] = ATan2( dirX, dirZ )
mRotation[2] = rollAngle
End

Method LookAt:Void( targetEntity:Entity, rollAngle:Float = 0.0 )
LookAt( targetEntity.mPosition, rollAngle )
End
[/CODE]

PS
I made a typo in code for "ProjectedY" function - it returns X component instead of Y :-(
 

Amon

Member
Joined
Nov 19, 2018
Messages
54
Is there a possibility of adding animated .obj model import and thus not needing to use the model converter?
 

JaviCervera

Member
3rd Party Module Dev
Joined
Jul 12, 2017
Messages
81
@Amon: FBX is a complex format. Supporting it would be easier if Vortex was written in C++, because we could use Assimp or Autodesk's FBX SDK to do the importing. Even although using meshtool requires an additional model conversion, I prefer this approach, since it generates a format optimized for Vortex. It would probably be easier to add animation support for the B3D loader MikeHart has already written. How good is B3D support nowadays in the most popular modelling applications?

@innerloop: That LookAt function seems correct. An implementation could also be done with the code in meshtool.cxs, lines 108-110, and the Vec3Pitch and Vec3Yaw functions at the end of that file. Actually, I could add a Vec3LookAt function to math3d.cxs.

@MikeHart: Please do a PR to branch release/2.0 and I'll review it later this week.
 
Last edited:

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
329
Ah missed that one. Thanks for your work. :)
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
2,988
I raised an issue about his latest published changes on github made it unusable over a month ago but so far no response. I hope he is OK but that doesn't look insuring.
 
Top Bottom