about entittys

Blitz3D Forums/Blitz3D Beginners Area/about entittys

Santiworld(Posted 2009) [#1]
hi, i want to know what happend in these case with the cameras, and with other entitys like boxes when have the same name, or not have name like the white box. how can i control that entitys?..

or how can i know if i have 1 or 2 cameras rendering.

regards...

graphics3d 640,480

createcube()

box = createcube()
moveentity box,1,0,1
entitycolor box,255,100,100

box = createcube()
moveentity box,-1,0,1
entitycolor box,100,100,255

cam = createcamera()
cam = createcamera()

moveentity cam,10,10,10
pointentity cam,box

createlight(1,cam)

while not keyhit(1)



turnentity box,.31,.31,.31

updateworld()
renderworld()

text 0,0,"i hace 2 cameras?"
text 0,20,"what happend with the red box? "
text 0,40,"how can i turn the red box?"
flip

wend
end



Warner(Posted 2009) [#2]
createcube()

This code creates a cube, but it's handle isn't stored. So the cube exists, but you can never change,
move/scale/turn or delete it. Not in a normal way that is.

box = createcube()
moveentity box,1,0,1
entitycolor box,255,100,100

box = createcube()
moveentity box,-1,0,1
entitycolor box,100,100,255

This situation is similair, the handle of the first box is discarded. In order to be able to use it,
you should keep it's handle somehow.

cam = createcamera()
cam = createcamera()

Again, the first camera's handle is disposed.

If you want multiple camera's to render to the screen, there are two things you can do. You can (1)
use CameraViewPort to choose the screen area the camera should render onto or (2) use CameraClsMode,
so the second camera doesn't clear the screen when it renders.
The camera's will render in the same order in which they are created.
So if you want to use CameraClsMode, you should use it on the second camera.

If you want to create multiple objects with the same name, use a Type.



GfK(Posted 2009) [#3]
hi, i want to know what happend in these case with the cameras, and with other entitys like boxes when have the same name
What you have is a pointer to the entity, not a name for it.

Again, the first camera's handle is disposed.
Its important to mention that although the handle is effectively disposed of, the entity data is not. Therefore what you've created is a memory leak - a block of allocated memory that you don't have any means of access to. This is potentially very bad.

If you want hundreds of cubes etc, store them in an array.


Santiworld(Posted 2009) [#4]
ok.. thanks.. other cuestion...

if i use clarworld() the entitys without handle are eliminated?


Warner(Posted 2009) [#5]
Well, try it. If it disappears, it's gone.


Santiworld(Posted 2009) [#6]
lol, you rught! :)