[Solved] 6.03 - CreatePlane()

Everything related to 3D programming
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

[Solved] 6.03 - CreatePlane()

Post by J. Baker »

Tile size is 1x1 and the plane should be 5x5 tiles width and depth but it only creates a 1x1 tile sized plane?

Code: Select all

DPI.d = DesktopResolutionX()

InitEngine3D()
InitSprite()

  OpenWindow(0, 0, 0, 640, 480, "Plane example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
  OpenWindowedScreen(WindowID(0), 0, 0, 640 * DPI, 480 * DPI, #True, 0, 0)

    ; Light
    CreateLight(#PB_Any, RGB(25, 25, 180), -5, 10, 5, #PB_Light_Point)
  
    ; Camera
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0, 2, 1, 3, #PB_Absolute | #PB_Local)
    CameraLookAt(0, 0, 0, 0)
  
    ; Create the plane and attach it to the scene
    CreatePlane(0, 1, 1, 5, 5, 0, 0)
    CreateEntity(0, MeshID(0), #PB_Material_None)

Repeat
  RenderWorld()
  FlipBuffers()
Until WaitWindowEvent(1) = #PB_Event_CloseWindow
Last edited by J. Baker on Mon Oct 23, 2023 2:47 am, edited 2 times in total.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: 6.03 - CreatePlane()

Post by juergenkulow »

Documentation CreatePlane()
Result = CreatePlane(#Mesh, TileSizeX, TileSizeZ, TileCountX, TileCountZ, TextureRepeatCountX, TextureRepeatCountZ)
TileCountX Number of tiles used to create the X axis of the plane.
TileCountZ Number of tiles used to create the Z axis of the plane.

OGRE Documentation MeshPtr Ogre::MeshManager::createPlane (...
int xsegments = 1,
int ysegments = 1,...

Examples/ScaleMaterial.pb
Modify ScaleMaterial.pb:

Code: Select all

    ;- Mesh
    CreatePlane(0, 30, 10, 2, 2, 1, 1) 
    ; CreatePlane(0, 30, 10, 1,1, 1, 1) 
    GetMeshData(0,0,DataArray(), #PB_Mesh_Vertex,0,8)  ;3 
    For i=0 To 8  ; 3
      Debug Str(DataArray(i)\x)+" "+Str(DataArray(i)\y)+" "+Str(DataArray(i)\z)
    Next  

Code: Select all

15 0 -5
0 0 -5
-15 0 -5
15 0 0
0 0 0
-15 0 0
15 0 5
0 0 5
-15 0 5

Code: Select all

15 0 -5
-15 0 -5
15 0 5
-15 0 5
Is PB TileCountX OGRE xsegments?
Is PB TileCountZ OGRE ysegments?
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: 6.03 - CreatePlane()

Post by J. Baker »

Could you post the full source? Not sure what you are stating here as to what I was asking or referring to.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: 6.03 - CreatePlane()

Post by juergenkulow »

Code: Select all

; https://www.purebasic.com/french/documentation/Examples/ScaleMaterial.pb.html
IncludeFile #PB_Compiler_Home + "examples/3d/Screen3DRequester.pb" 
  
Dim DataArray.MeshVertex(100)

If InitEngine3D()
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/"                , #PB_3DArchive_FileSystem)
    Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures"        , #PB_3DArchive_FileSystem)
    
    ; Material
    ;
    CreateMaterial(0, LoadTexture(0, "MRAMOR6X6.jpg"))
    
    ; Scaled Material
    ;
    CopyMaterial(0, 1)
    ScaleMaterial(1, 1, 3)
    
    ;- Mesh
    CreatePlane(0, 30, 10, 2, 2, 1, 1)
    GetMeshData(0,0,DataArray(), #PB_Mesh_Vertex,0,8)  ;3 
    For i=0 To 8; 3
      Debug Str(DataArray(i)\x)+" "+Str(DataArray(i)\y)+" "+Str(DataArray(i)\z)
    Next   
    ;- Entity without material scaled
    CreateEntity(0, MeshID(0), MaterialID(0), -16, 0, 0)
    
    ;-Entity with Material scaled
    CreateEntity(1, MeshID(0), MaterialID(1),  16, 0, 0)
     
    ; Camera
    ;
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0, 0, 50, 2, #PB_Absolute)
    CameraLookAt(0, 0, 0, 0)
    CameraBackColor(0, RGB(0, 0, 30))
    
    ;- Light
    ;
    AmbientColor(RGB(75, 75, 75))
    CreateLight(0, RGB(255, 255, 255), 0, 500, 0)
    
    Repeat
      Screen3DEvents()
      
      ExamineKeyboard()
      RenderWorld()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape)
    
    End
    
  EndIf
Else
  MessageRequester("Error","Can't initialize engine3D")
EndIf

; 15 0 -5
; 0 0 -5
; -15 0 -5
; 15 0 0
; 0 0 0
; -15 0 0
; 15 0 5
; 0 0 5
; -15 0 5
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: 6.03 - CreatePlane()

Post by J. Baker »

Thanks for posting but this is what I do not understand and will talk about the code you just posted. No matter if TileCountX and/or TileCountZ is 1 or 2, the result is the same. This is what I was originally asking about. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: 6.03 - CreatePlane()

Post by juergenkulow »

The mesh created by CreatePlane has at TileCountX=1, TileCountY=1 4 vertex, points at 2 , 2 9 vertex, points and at 9 ,9 100 vertex, points. The documentation is not clear enough.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: 6.03 - CreatePlane()

Post by J. Baker »

Oh, yeah I didn't get that. Thanks!
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply