Beta release 3.1b

Information and change log about the latest ZGameEditor release.

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1879
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:roll:

Would have been nice if it was identical to how you access individual vector elements of components.

Code: Select all

// So, like this ..
App.CameraPosition.X = 1;

// instead of this ..
App.CameraPosition[0] = 1;
But i noticed in the source code that the vec3 / mat4 types are based on the array component, which probably explains why it is the way it is at the moment.

K
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Remember, it is a work in progress :)

The reason they are arrays internally is because that was the most simple and compact way to implement them. I usually pick that way forward first and see if it does the job.

Update today:
- mat4 and vec3 can be passed as xptr parameter to external functions.
- vec3[0] av; av[0][0]=1; etc. syntax supported.

http://www.zgameeditor.org/files/ZGameEditor_beta.zip
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

nice upgrades, thank you VilleK for all your efforts :D

you should really accept donations, since it is a "thank you, please keep this, hope you will use it for good someday" from us

btw, im gonna change the topic fast :S found this FOSS GDK(SDK) for iOS and Android, the bad point is that it is written in C++, but hope it can help you to integrate Skeletical animations since GFX (the SDK name) supports it.
http://gfx.sio2interactive.com/

hey VilleK! I just remembered...

¿What did you decide about supporting the Android Gaming Console OUYA?

thanks in advance :)
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Would be nice to have kind of "constructor" functions for vec3 and mat4, e.g.:

Code: Select all

void fnc(vec3 a){...} // function definition

fnc(vec3(10, 2.2, 3.5)); // function calling
For now, I'm implementing these "constructor" functions in a ZLibrary, for example:

Code: Select all

// constructs vec3 from 3 floats
vec3 _vec3(float x, float y, float z){
  vec3 result;
  result[0] = x;
  result[1] = y;
  result[2] = z;
  return result;
}
It would probably be sufficient to have some embedded library, e.g., to extend the existing Vector Library. BTW this library should be rewritten to vec3 types, removing the global Vector array.

What about to allow initialization of the defined arrays, for example:

Code: Select all

vec3 result = {x, y, z};
When doing rotations with quaternions I would really appreciate vec4. For texture mapping vec2. Any chance to have them added?
User avatar
Kjell
Posts: 1879
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hmm,
Rado1 wrote:When doing rotations with quaternions I would really appreciate vec4. For texture mapping vec2. Any chance to have them added?
I don't think it should be necessary / high-priority to add variable types that are basically a array of a already supported type without any specific functions / operators to compliment them. Should be only a minor inconvenience to return a vec2 / vec4 as float[] instead.

Out of curiosity .. why do you need vec2 for texture mapping? Aren't bytes ( when the texture is 256x256 pixels or smaller ) or shorts usually sufficient?

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

Post by Rado1 »

Kjell wrote:I don't think it should be necessary / high-priority to add variable types that are basically a array of a already supported type without any specific functions / operators to compliment them.
Of course it is not necessary, just little bit convenient and type safer, because float[] covers vectors of any length. It might be a problem if instead of expected float[4] is passed float[2] array as argument of a function call.
Kjell wrote:Out of curiosity .. why do you need vec2 for texture mapping? Aren't bytes ( when the texture is 256x256 pixels or smaller ) or shorts usually sufficient?
For instance, in one of my projects, I wanted to achieve "static" textures mapped to objects of different sizes and placed on different positions. Objects are created by VBOs. By "static" I mean that the placement of texture depends on world's coordinates, not on position of objects it is placed on. Here, the texture coordinates used coordinates of mesh points. See the attached example which demonstrates the effect. Mouse changes the camera rotation, LMB moves forward and RMB moves backward.

Question: In the example, float[400,12] Faces array was used for vertex array buffer. I tried to use vec3[400,4] Faces, but does not work. Where's the problem?
Attachments
static_texture.zgeproj
example of "static" texture
(6.82 KiB) Downloaded 464 times
screenshot
screenshot
scr.jpg (37.36 KiB) Viewed 15665 times
User avatar
Kjell
Posts: 1879
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Rado1,
Rado1 wrote:For instance, in one of my projects, I wanted to achieve "static" textures mapped to objects of different sizes and placed on different positions. Objects are created by VBOs. By "static" I mean that the placement of texture depends on world's coordinates, not on position of objects it is placed on. Here, the texture coordinates used coordinates of mesh points. See the attached example which demonstrates the effect.
Probably not the best example to prove your point. You have the same data ( interleaved with the Z position ) twice. Simply re-use your vertex position buffer for the texture coordinates as well.

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

Post by Rado1 »

This was just a simplified example used to demonstrate what I meant by "static" texture mapping. In real project I'm using all 3 dimensions and vertex coordinates are different from texture coordinates.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rado1 wrote:Question: In the example, float[400,12] Faces array was used for vertex array buffer. I tried to use vec3[400,4] Faces, but does not work. Where's the problem?
This is a problem with the current implementation and it's the same reason why Kjell could not pass an array of mat4 to shaders. I need to rearrange how mat4 and vec3's are stored in memory. Using DefineArray as an underlying storage will probably have to be replaced with raw memory. This should not affect anything on the syntax level of things though.
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

hey VilleK, just found another FOSS SDK with support for FreeType fonts in GUI apps....

Is this a bit hard to implement? thanks in advance :)

http://www.linderdaum.com/home/index.php?title=Features
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Ouya: I downloaded the SDK but I haven't had time to look at it yet. I'm under the impression that it should not be too hard to adapt a normal Android app to be Ouya compatible? Maybe Rado1 or someone else with ZGE Android experience can take a quick look at it.

Bones/mesh animations: I do want to implement this at some point and there are many open source implementations that we can examine for reference.

Freetype: There is an official freertype multiplatform library so the best way would perhaps be to see if this can be used as an ExternalLibrary from ZGE.

For the moment though this new type support with mat4, vec3 etc. will keep me busy for a while :)
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:I'm under the impression that it should not be too hard to adapt a normal Android app to be Ouya compatible? Maybe Rado1 or someone else with ZGE Android experience can take a quick look at it.
Ville, you are right. It is simple to create an OUYA application with SDK. Unfortunately, it is relatively difficult to create an external library with NDK - a lot of JNI would be needed, no guarantee that it is even possible in ZGE. My original intention was to create an external library for OUYA, but failed (at the moment).
VilleK wrote:Freetype: There is an official freertype multiplatform library so the best way would perhaps be to see if this can be used as an ExternalLibrary from ZGE.
I had a look at API and it would be necessary to create a wrapper for ZGE. My question is: is it really necessary? AFAIK FreeType is a font engine/server used to generate glyph images. Why not to use pregenerated font bitmaps instead?
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

Rado1 wrote:Is it really necessary?
You are right, it is not really necessary, bitmaps already do the job, but might be a extra feature.

VilleK thank you for you reply, don't worry about busy time, just was c suggestion or comment, take your time and live as you want :)
User avatar
Kjell
Posts: 1879
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

@jonaspm,

The thing is, a empty standalone executable ( using standard compression ) made with ZGameEditor is currently 28KB. The FreeType ( dynamic link ) library is 522KB.

It's fine if you want to use it as external library for a ZGameEditor project, but because of its size i don't think Ville would even consider implementing it.

K
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Update:
- The new types are now: mat4, vec2, vec3, vec4
- Utility functions to create the above: vector2(x,y), vector3(x,y,z), vector4(x,y,z,w). I first tried to name them vec2 etc. like in GLSL but could not get the parser to accept that a name of a type could also be the name of a function.

I've redesigned the way mat/vec types are stored in memory and came up with a hybrid solution: when they are declared outside arrays they are using a garbage collected DefineArray component. When in arrays they are stored by value. This makes sure that it is easy and efficient to pass them around to/return from functions, while when stored in arrays the arrays can be passed to GL-functions and behave as expected.

There have been big underlying changes so I'm sure there are bugs. Please try it out. I'm also attaching Rado1 test project that I've modified to use the new array types.

http://www.zgameeditor.org/files/ZGameEditor_beta.zip
Attachments
static_texture.zgeproj
Rado1s project updated by me
(6.39 KiB) Downloaded 478 times
Post Reply