Page 9 of 11

Posted: Fri Oct 14, 2005 10:40 pm
by Comtois
in the doc i can read
CreateEntity(#Entity)

If the #Entity was already created, it is automatically freed and replaced by the new one.
In the MeshManual.pb example I try to replace the entity :

Code: Select all

    CreateEntity(1, MeshID(0), MaterialID(0))
    EntityLocate(1,0,0,0)
    ScaleEntity(1, 3, 1, 3)
    ;FreeEntity(1) 
    CreateEntity(1, MeshID(0), MaterialID(0))
    EntityLocate(1,400,0,0)
I must add FreeEntity(1) to see the new entity

Code: Select all

FreeEntity(1) 

Posted: Thu Nov 17, 2005 9:15 pm
by Comtois
can't load a map .bsp with LoadWord() , the same map work fine with the old enginedll.

Posted: Thu Nov 17, 2005 10:50 pm
by dell_jockey
Comtois wrote:can't load a map .bsp with LoadWord() , the same map work fine with the old enginedll.
from Fred's first post that opened this thread:
Fred wrote:LoadWord() (ie BSP support) doesn't work anymore as DX7 renderer doesn't support the 32 bits hardware vertex buffers (only 16 bits limited)

Posted: Thu Nov 17, 2005 11:03 pm
by Comtois
Exact, I did not remember it, thank you.

Posted: Fri Nov 18, 2005 6:27 pm
by Comtois
In MeshManual.pb i try #PB_any , work fine for the first entity , but if i add a second entity , i get an error :?

[ERROR] specified #Entity is not initialised.

Code: Select all

    NoEntity=CreateEntity(#PB_Any, MeshID(0), MaterialID(0))
    EntityLocate(NoEntity,0,0,0)
    
    NoEntity=CreateEntity(#PB_Any, MeshID(0), MaterialID(0))
    EntityLocate(NoEntity,200,0,0)

So i try FreeEntity(NoEntity) before created the second entity and i get a big crash.

Code: Select all

    NoEntity=CreateEntity(#PB_Any, MeshID(0), MaterialID(0))
    EntityLocate(NoEntity,0,0,0)
    
    FreeEntity(NoEntity)
        
    NoEntity=CreateEntity(#PB_Any, MeshID(0), MaterialID(0))
    EntityLocate(NoEntity,200,0,0)

Posted: Sat Nov 26, 2005 10:30 pm
by Comtois
I try SkyBox.pb, it's weird :?


[French]
ça fonctionnait très bien avec l'ancienne lib.
Avec la version beta , la planète bleue est mal affichée ,une moitié d'un côté, l'autre moitié de l'autre côté de la box [/French]

[EDIT]
Fred wrote:About the skybox, the files needed by the skybox needs to be slightly changed (look at the skybox files found in the Ogre demo package 1.0.3 on ogre3d.net, they work as expected)
Ok , i must read again all post :)

Posted: Sat Nov 26, 2005 11:24 pm
by Comtois
Small demo (only exe for the moment) , show two bugs :
- The skyBox
- SomeTime , Entity (wall) is not drawing ( if i incline camera down )

http://perso.wanadoo.fr/comtois/sources/VisuMap3D3.zip

[EDIT]
Fred wrote:About the skybox, the files needed by the skybox needs to be slightly changed (look at the skybox files found in the Ogre demo package 1.0.3 on ogre3d.net, they work as expected)
ok work fine now

Posted: Sun Nov 27, 2005 11:31 am
by thefool
nice! That map editor rocks :D i know its simple but it does work hehe

Posted: Sun Nov 27, 2005 1:10 pm
by Comtois
Two people said to me that they did not see the walls. In this demonstration I created a meshe by wall to manage coordinates UV of texture. there are 90 meshes and 90 entity. Which are the limits?

Posted: Sun Nov 27, 2005 1:28 pm
by Nik
It desn't start here it says it needs the engine3d.dll but after I put it into its directoy it still doesn't work. Map Editor works.

Posted: Sun Nov 27, 2005 1:41 pm
by Comtois
You need the engine3D.Dll beta (ogre 1.03) and stlport_vc646.dll

Posted: Sun Nov 27, 2005 1:51 pm
by thefool

Posted: Fri Apr 21, 2006 11:07 pm
by Dräc
Comtois wrote:@Fred

I try to add this in the shadow.pb example :

Code: Select all

CameraProjection(0,#PB_Camera_Orthographic)
i see nothing , how does it work ? can you show a example ?

Btw, a cameraProjection would be nice for projection 3D-2D or 2D-3D.
for example to to obtain the position of a entity on the screen
Or to select a entity with mouse.
Any correction planned ?

Posted: Fri Apr 21, 2006 11:18 pm
by Fred
It should work with the v4, here is a sample:

Code: Select all

#CameraSpeed = 10

IncludeFile "Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY

If InitEngine3D()

  Add3DArchive("Data\", #PB_3DArchive_FileSystem)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
    WorldShadows(#PB_Shadow_Additive) ; Set the shadow mode for the world
    
    AmbientColor(RGB(128,128,128))
    
    ; Create a plan, manually
    ;
    CreateMesh(1,100)
    SetMeshData(1, #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_UVCoordinate, ?PlanVertices, 4)
    SetMeshData(1, #PB_Mesh_Face, ?PlanFaces, 2)
    
    LoadMesh   (0, "Robot.mesh")
    LoadTexture(0, "r2skin.jpg")
    
    CreateEntity (0, MeshID(0), CreateMaterial(0, TextureID(0)))
    AnimateEntity(0, "Walk")

    CreateMaterial(1, LoadTexture(1, "Background.png"))
    CreateEntity (1, MeshID(1), MaterialID(1))
    
    EntityRenderMode(1, 0) ; Disable shadow casting for this entity as it's our plan
    ScaleEntity(1, 1000, 1, 1000)
    MoveEntity(1, -500, 0, -500)
    DisableMaterialLighting(1, #False)
    
    CreateLight(0, RGB(255,255,255))
    
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0, 2000, 2000, 2000) ; 3D iso view
    CameraLookAt(0, 0, 0, 0)
    
    ResizeEntity(0, 4, 4, 4)
    
    CameraProjection(0, #PB_Camera_Orthographic)
    
    LightLocate(0, CameraX(0), CameraY(0), CameraZ(0))
      
    Repeat
      Screen3DEvents()
      
      ClearScreen(RGB(0, 0, 0))
            
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Up)
          EntityLocate(0, ex, 0, 0)
          ex+3
        EndIf
        
        If KeyboardPushed(#PB_Key_Down)
          EntityLocate(0, ex, 0, 0)
          ex-3
        EndIf


      EndIf
      
      If ExamineMouse()
        ;MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
        ;MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
      EndIf
            
      RenderWorld()      
        
      Screen3DStats()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
    
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
  
End

DataSection

  PlanVertices:
    
    ; Note normals are important component to allow correct light support (and therefore shadow)
    ;
    Data.f 0, 0, 0    ; Vertex 0
    Data.f 1, 1, 1    ; Normals (perpendicular to the plan)
    Data.f 0   , 0.33 ; UVCoordinate
    
    Data.f 1, 0, 0    ; Vertex 1
    Data.f 1,1,1      ; Normals
    Data.f 0.33, 0.33 ; UVCoordinate
    
    Data.f 1, 0, 1    ; Vertex 2
    Data.f 1,1,1      ; Normals
    Data.f 0.33, 0    ; UVCoordinate
    
    Data.f 0, 0, 1    ; Vertex 3
    Data.f 1,1,1      ; Normals
    Data.f 0,    0    ; UVCoordinate

  PlanFaces:
    Data.w 2, 1, 0 ; bottom face (clockwise as it's reversed...)
    Data.w 0, 3, 2 

EndDataSection

Posted: Sat Apr 22, 2006 10:06 am
by Dräc
Works fine, my mistake...
Thank you very much for the sample which corrects me, Fred !