3D Entity System [DE]

Previous topic - Next topic

Quentin

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?

Moru

Wasn't there something about bumpmapping and NVIDIA drivers that you had to turn off or did they fix that bug?

Quentin

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.

codegit

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

Quentin

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

codegit

@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

bigsofty

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)

Kitty Hello

OK, I fixed that. I'll then.

bigsofty

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)

Quentin

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 :)

bigsofty

#325
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
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)

Quentin

normally it should be possible to switch between different cameras. Do you have an example of this bug?

FutureCow

Can someone give a quick summary in English of what the entity system is for?

Kitty Hello

#328
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.

bigsofty

Quote from: Quentin on 2010-Feb-15
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)