Another 3D problem - swapping cameras
Blitz3D Forums/Blitz3D Programming/Another 3D problem - swapping cameras
| ||
ok i have another problem. I have 2 cameras, set as gCamera=CreateCamera() gCameraHidden=CreateCamera(gCamera) PositionEntity gCamera,1,1,1 PositionEntity gCameraHidden,1,gHiddenOffset,1 gHiddenoffset = -500 The idea is to have meshes at the hidden offset level (500 below the plane) while the main camera views the terrain. This works ok. I then am suppose to copy snap shots of the backbuffer meshes from the hidden camera and copy them as a texture to sprites on the terrain. The problem seems to be behind-the-scene camera swapping doesn't seem to work. For p.warrior=Each warrior If EntityName$( p\entity ) = "OriginalObject" ; if first, grab sprite texture from object HideEntity gCamera ; hide terrain camera ShowEntity gCameraHidden ; show hidden camera If EntityInView( p\entity, gCameraHidden ) = True box3dobject( p\entity, gCameraHidden ) ; box mesh view If (gRight - gLeft) > 0 And (gBottom - gTop) > 0 Then SetBuffer TextureBuffer(gHopImage) Rect( gLeft, gTop, (gRight - gLeft), (gBottom - gTop), 0) CopyRect( gLeft, gTop, (gRight - gLeft), (gBottom - gTop),0,0, BackBuffer(), TextureBuffer(gHopImage) ) SetBuffer BackBuffer() EndIf EndIf HideEntity gCameraHidden ShowEntity gCamera EndIf If EntityName$( p\entity ) = "Sprite" ; sprite If gHopImage > 0 Then EntityTexture p\entity, gHopImage PositionTexture gHopImage, 0.0, 0.0 EndIf EndIf etc etc The above code works except for the switching to the hidden camera, instead i get a copy of the terrain texture (from the main camera). if i was to manually go to the hidden camera (see the hidden view on screen) then it would work and i would get the texture of the mesh. The idea is to have a hidden plane that's never seen on screen, where meshes are animated and snap shot textures are taken from them, to place on sprites on the terrain. Hope I explain that in plain english? |
| ||
have a look at this page :- http://www.blitzbasic.com/b3ddocs/command.php?name=CameraProjMode&ref=3d_cat use these commands to hide/show the cameras. Maybe this will sort your problems |