Scene/World statistics -> triangle count...

Everything related to 3D programming
Krix
User
User
Posts: 65
Joined: Fri Mar 11, 2005 6:24 pm
Location: Toronto

Scene/World statistics -> triangle count...

Post by Krix »

Hey guys!

I can't seem to find any command for the built in Ogre3D in the PB manual nor in the forum regarding triangle count in the rendered scene. I would like to get the number of triangles rendered by the active camera. Is there any way to do that?

Thanks!
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Scene/World statistics -> triangle count...

Post by applePi »

krix, in Pb5.50++ there is Engine3DStatus(#PB_Engine3D_NbRenderedTriangles )
look the Docs for Engine3DStatus
here the cube rendered triangles is displayed in the WindowTitle, so run the program as windowed

Code: Select all


#CameraSpeed = 5

IncludeFile #PB_Compiler_Home + "examples/3d/Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY


If InitEngine3D()
  
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
        
    CreateMaterial(0, LoadTexture(0, "White.jpg"))
    SetMaterialColor(0, #PB_Material_AmbientColor, #PB_Material_AmbientColors)
    MaterialShadingMode(0, #PB_Material_Wireframe)
    MaterialCullingMode(0, #PB_Material_NoCulling)


    CreateCube(0, 1)
    CreateEntity(0, MeshID(0), MaterialID(0))
    ScaleEntity(0, 400, 200, 400)
    
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0, 0, 0, 1000, #PB_Absolute)
    
    CreateLight(0, RGB(255,255,255), 300, 600, -100)
    AmbientColor(RGB(255, 255, 255))
    
    Repeat
      Screen3DEvents()
      
      If ExamineMouse()
        MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
        MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
      EndIf
      
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf
        
      EndIf
      
      RotateEntity(0, 0.5, 0.5, 0.5, #PB_Relative)
      
      RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
      MoveCamera  (0, KeyX, 0, KeyY)
      
      RenderWorld()
      Screen3DStats()      
      FlipBuffers()
      SetWindowTitle(0, "FPS = "+Str(Engine3DStatus(#PB_Engine3D_CurrentFPS ))+" rendered triangles = "+Str(Engine3DStatus(#PB_Engine3D_NbRenderedTriangles )))
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf

End

Krix
User
User
Posts: 65
Joined: Fri Mar 11, 2005 6:24 pm
Location: Toronto

Re: Scene/World statistics -> triangle count...

Post by Krix »

I don't know how I missed that. Thanks applePi!
Post Reply