Beta release 3.1b

Information and change log about the latest ZGameEditor release.

Moderator: Moderators

Post Reply
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Another suggestion: vec* and mat4 types can be highlighted in code editor such as other types. Also the content assistant should provide them as types when pressed Ctrl+Space.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Another suggestion (of minor importance): global float variables defined in ZLibrary should be used as sources of values for e.g. in RenderText.TextFloatRef and other similar properties. If they are used in this way in the current ZGE beta, they cause corrupting of the project file which cannot be opened without manual fixing in text editor. Thanks.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rado1, I'm going to check the things you reported soon. ZGE work is down at the moment because of nice weather :).
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Hi Ville, I fully understand, thanks. BTW here's another possible improvement:

The most common thing appearing in ZgeBullet 3D physical simulation is to set position and rotation of a Model according to the computed simulated values. At the moment the functions such as

Code: Select all

int zbtGetPosition(int collisionObjectId, ref float x, ref float y, ref float z) {}
are called in a quite cumbersome way:

Code: Select all

zbtGetPosition(ObjectId, CurrentModel.Position.X, CurrentModel.Position.Y, CurrentModel.Position.Z);
I would appreciate much compact form:

Code: Select all

definition:
int zbtGetPosition(int collisionObjectId, ref vec3 pos) {}

usage:
zbtGetPosition(ObjectId. CurrentModel.Position)
At the moment, ZGE reports "Cannot get address of expression: ((vec3)CurrentModel.Position)" syntax error for function call. Would it be possible to access vec3 properties of components in this way?

Another improvement: In ZGEBox2D are usually updated just X and Y components of Position. What about to:

Code: Select all

call this declaration:
zb2GetPosition(int body, ref vec2 pos) {}

in this way:
zb2GetPosition(BodyId, CurrentModel.Position);
? In this case I would expect to set just X and Y items; no syntax error.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Rado1,

Although this isn't the best / a real solution, and you probably thought of this already .. you could write a ZLibrary for those kind of things. For example ..

Code: Select all

int bulletGetPosition(int id, ref vec3 position)
{
  return zbtGetPosition(id, position.x, position.y, position.z);
}
.. and ..

Code: Select all

void box2DGetPosition(int id, ref vec3 position)
{
  position.x = zb2GetPositionX(id);
  position.y = zb2GetPositionY(id);
}
K
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Hi Kjell, I would like to avoid the intermediate conversion functions in ZLibrary and to pass, e.g., CurrentModel.Position directly to C++ code.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Even if vec3 syntax would be accepted it would not work because a ZGE vec3 is not the same as a C++ float[3], instead it is a automatically memory managed structure that maps to a ZGE Array object. So it would not have the memory layout that C++ expects.

I would instead try:

zbtGetPosition(int collisionObjectId, xptr pos)

Because "xtpr" instructs ZGE to pass a pointer to the underlying data which in this case would be the actual float[3] position value of a Model.Position. Let me know if that doesn't work.

edit: and if "model.position" is not xptr compatible, try passing "model.position.x" and treat it as a float[3] pointer on the C++ side.
Last edited by VilleK on Fri May 30, 2014 1:17 pm, edited 1 time in total.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Good idea Ville, however, both CurrentModel.Position and CurrentModel.Position.X result in syntax error "Invalid conversion: ((xptr)CurrentModel.Position)" or "Invalid conversion: ((xptr)CurrentModel.Position.X)" respectively.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I'll check the xptr issue. New suggestion, try: try declaring as "ref float pos", pass "model.position.x" and treat it as a float[3] pointer on the C++ side.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:I'll check the xptr issue. New suggestion, try: try declaring as "ref float pos", pass "model.position.x" and treat it as a float[3] pointer on the C++ side.
Thanks, BTW the idea of "ref float pos" works fine. However, it's not very intuitive for usage at the side of ZGE and I would prefer to pass"model.Position" directly, if possible.
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

Hello guys! sorry if this is a bit off-topic...

Ville, at the ZGE homepage, the list of recent forum topics is not getting updated...

thanks and sorry again!
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

@jonaspm: Thanks for noticing, I fixed it now. It had timeout value set too low.

@Rado1: I've fixed the WebOpen component so that it can now work with binary files, as you reported here: viewtopic.php?p=6889#6889

http://www.zgameeditor.org/files/ZGameEditor_beta.zip
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ville, thanks! Tested and works perfectly! Now, I'm going to finish semi-automatic ZGE help generator from wiki.

Can I expect that ZGE will support passing vec3 parameters (e.g. "model.Position") to functions (external functions) one day?
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

- xptr syntax extended (passing Model.Position to xptr should work now)
- Fixed "App.CameraPosition=GlobalVarV3;" syntax.
- vec*/mat4 types included in editor autosuggestions.

http://www.zgameeditor.org/files/ZGameEditor_beta.zip
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Tested and works perfectly. Thanks Ville! Now, I can update functions of physical libraries to reduce number of parameters, to be called in more comfort way and to perform a little bit better.
Post Reply