Author Topic: 3D Entity System [DE]  (Read 171382 times)

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [DE]
« Reply #315 on: 2010-Feb-12 »
That's really funny. I just tested your TestJim() function.

If I switch on Debug mode, the texture is shown as expected. If I turn off Debug mode, texture isn't shown ....

Gernot?

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: 3D Entity System [DE]
« Reply #316 on: 2010-Feb-12 »
Wasn't there something about bumpmapping and NVIDIA drivers that you had to turn off or did they fix that bug?

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [DE]
« Reply #317 on: 2010-Feb-12 »
hmm don't think so, I guess this bug is because of the internal sprite handling of GLBasic

if you use
Code: (glbasic) [Select]
jtex = GENSPRITE()
LOADSPRITE "bump.png", jtex
instead of
Code: (glbasic) [Select]
jtex = EntityLoadTexture("bump.png")

the program works. Texture is shown as it should be.

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: 3D Entity System [DE]
« Reply #318 on: 2010-Feb-12 »
Thanks. I will try this.
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [DE]
« Reply #319 on: 2010-Feb-12 »
you can even change the function EntityLoadTexture

just replace
Code: (glbasic) [Select]
t = EntityGetFreeTexture()
with
Code: (glbasic) [Select]
t = GENSPRITE()

This works as well, but it's not the same, as EntityGetFreeTexture() starts counting at 1, GENSPRITE at 0. I couldn't see if this makes any difference to the rest of the ES

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: 3D Entity System [DE]
« Reply #320 on: 2010-Feb-12 »
@Quentin.

Thanks mate. This all works now.  =D
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2793
    • View Profile
Re: 3D Entity System [DE]
« Reply #321 on: 2010-Feb-15 »
A big thanks to all involved in this lib, once you work with it you realise just how good it is.  :happy:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10852
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: 3D Entity System [DE]
« Reply #322 on: 2010-Feb-15 »
OK, I fixed that. I'll then.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2793
    • View Profile
Re: 3D Entity System [DE]
« Reply #323 on: 2010-Feb-15 »
Trying to get the camera entity working... it does not work currently with multiple cameras, blank screen or invalid entities, when switching.

This function,

Code: (glbasic) [Select]
// ------------------------------------------ //
//! Creates an entity that represents a camera.
//! You can have several cameras, though the one used for
//! scene rendering is the one you enabled last. This function
//! enalbes the new camera, thus making it the default camera.
// \return the entity entity
// ------------------------------------------ //
FUNCTION EntityCreateCamera:
LOCAL t AS T3DEntity
LOCAL e
t.what = 1
t.name$="camera"
e = EntityAddInternal(t)
EntityEnable(e, TRUE)
RETURN e
ENDFUNCTION

Returns an invalid entity (Entity+1) and EntityEnables twice etc... it should read...

Code: (glbasic) [Select]
// ------------------------------------------ //
//! Creates an entity that represents a camera.
//! You can have several cameras, though the one used for
//! scene rendering is the one you enabled last. This function
//! enalbes the new camera, thus making it the default camera.
// \return the entity entity
// ------------------------------------------ //
FUNCTION EntityCreateCamera:
LOCAL t AS T3DEntity
LOCAL e
t.what = 1
t.name$="camera"
RETURN EntityAddInternal(t)
ENDFUNCTION

This get it up and running with cameras attached to entities but I'm have a little trouble with their orientation... they seem to flip when the parent entity is rotated?

I'm still trying to get familiar with the code, so that I can contribute a little.
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [DE]
« Reply #324 on: 2010-Feb-15 »
the problem is, that with EntityEnable all other cameras are disabled, so only one camera is active at at time. Thus, disabled cameras may be overwritten by following entities, added to the ES.

More ahead in this thread I suggested to add an attribute "deleted" to the ES so that disabled entities are not overwritten unless they are deleted. I already did this work for my own version, but it was deleted when installing Win 7 :(
I'll try to add it again :)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2793
    • View Profile
Re: 3D Entity System [DE]
« Reply #325 on: 2010-Feb-15 »
Sounds like a good idea Quentin.

With the above modification, multiple attached cameras do work but I did not try an introduce new entities, so I seem to have avoided this 'bug' by luck alone...  is this a bug or a feature? :P
« Last Edit: 2010-Feb-15 by bigsofty »
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [DE]
« Reply #326 on: 2010-Feb-15 »
normally it should be possible to switch between different cameras. Do you have an example of this bug?

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Re: 3D Entity System [DE]
« Reply #327 on: 2010-Feb-16 »
Can someone give a quick summary in English of what the entity system is for?

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10852
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: 3D Entity System [DE]
« Reply #328 on: 2010-Feb-16 »
In quick, the Entity system changes the handing of 3D objects. The ES (entity system) has a list of currently visible objects. You can then move/rotate/size the objects, and they keep that translation for good. There's one function to apply all the transformations you made to all objects and one to draw them all and one to check whether groups of objects have a collision in the current position.
Sort of a physics engine without physics but only for visuals.

[edit]
Fixed the delete/enable bits.
« Last Edit: 2010-Feb-16 by Kitty Hello »

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2793
    • View Profile
Re: 3D Entity System [DE]
« Reply #329 on: 2010-Feb-16 »
normally it should be possible to switch between different cameras. Do you have an example of this bug?

Changing the create camera function stopped the invalid entity when switching between cameras but the camera seems to suffer badly from gimbal lock when attached to another entity.
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)