What is Type and Mode in CreateMesh and FinishMesh?
which constants can I use?
CreateMesh, FinishMesh - Type, Mode?
CreateMesh, FinishMesh - Type, Mode?
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: CreateMesh, FinishMesh - Type, Mode?
Look at these examples, they show how To use CreateMesh() With the new constants :
- MeshManualFlag.pb
- MeshManualParametrics.pb
- MeshManual2.pb
Here is the List of new constants :
And the List of new examples :
- MeshManualFlag.pb
- MeshManualParametrics.pb
- CameraTrack.pb (now use AttachEntityObject() without bone)
- CheckObjectVisibility.pb
- CheckObjectVisibility2.pb
- ConvertLocalToWorldPosition.pb
- ConvertWorldToLocalPosition.pb
- CopyAngle.pb
- EnableManualEntityBoneControl.pb
- FetchOrientation.pb
- MeshManual2.pb
- MouseRayCast.pb
- RayCast.pb
- SetOrientation.pb (For Next release)
- MeshManualFlag.pb
- MeshManualParametrics.pb
- MeshManual2.pb
Here is the List of new constants :
Code: Select all
;Text3DAlignment()
Debug #PB_Text3D_Left
Debug #PB_Text3D_HorizontallyCentered
Debug #PB_Text3D_Above
Debug #PB_Text3D_Bottom
Debug #PB_Text3D_VerticallyCentered
;CreateMesh(), AddSubMesh()
Debug #PB_Mesh_PointList
Debug #PB_Mesh_LineList
Debug #PB_Mesh_LineStrip
Debug #PB_Mesh_TriangleList
Debug #PB_Mesh_TriangleStrip
Debug #PB_Mesh_TriangleFan
;Get/SetMaterialColor()
Debug #PB_Material_DiffuseColor
Debug #PB_Material_SpecularColor
Debug #PB_Material_AmbientColor
Debug #PB_Material_SelfIlluminationColor
;GetMaterialAttribute()
Debug #PB_Material_Shininess
Debug #PB_Material_TextureRotate
Debug #PB_Material_TextureUScale
Debug #PB_Material_TextureVScale
Debug #PB_Material_TextureUScroll
Debug #PB_Material_TextureVScroll
Debug #PB_Material_DepthWrite
Debug #PB_Material_Lighting
Debug #PB_Material_ShadingMode
;MaterialCullingMode()
Debug #PB_Material_NoCulling
Debug #PB_Material_ClockWiseCull
Debug #PB_Material_AntiClockWiseCull
And the List of new examples :
- MeshManualFlag.pb
- MeshManualParametrics.pb
- CameraTrack.pb (now use AttachEntityObject() without bone)
- CheckObjectVisibility.pb
- CheckObjectVisibility2.pb
- ConvertLocalToWorldPosition.pb
- ConvertWorldToLocalPosition.pb
- CopyAngle.pb
- EnableManualEntityBoneControl.pb
- FetchOrientation.pb
- MeshManual2.pb
- MouseRayCast.pb
- RayCast.pb
- SetOrientation.pb (For Next release)
Please correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
Re: CreateMesh, FinishMesh - Type, Mode?
CreateMesh(0, #PB_Mesh_TriangleList, #True)
Mode = #True . Mesh can be update
FinishMesh(#False) : #False if you need to update a mesh or attach a mesh to a node or a bone (you cant use it to create an entity).
FinishMesh(#True) : If you need to instantiate your mesh (using with CreateEntity())
Mode = #True . Mesh can be update
FinishMesh(#False) : #False if you need to update a mesh or attach a mesh to a node or a bone (you cant use it to create an entity).
FinishMesh(#True) : If you need to instantiate your mesh (using with CreateEntity())
Please correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
Re: CreateMesh, FinishMesh - Type, Mode?
I have modified MeshManual2.pb to show how to use MeshIndex()
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - MeshManual
;
; (c) 2012 - Fantaisie Software
;
; ------------------------------------------------------------
;
#CameraSpeed = 1
#scale = 3
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive("Data/fonts", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
;- Material
CreateMaterial(0, LoadTexture(0, "White.jpg"))
DisableMaterialLighting(0, #True)
;- Mesh Plane
CreateMesh(0, #PB_Mesh_LineStrip, #False)
MeshVertexPosition(-10, 0, -10)
MeshVertexColor(RGB(255,0,0))
MeshVertexPosition(-10, 0, 10)
MeshVertexColor(RGB(255,255,0))
MeshVertexPosition( 10, 0, 10)
MeshVertexColor(RGB(255,0,255))
MeshVertexPosition( 10, 0, -10)
MeshVertexColor(RGB(0,255,0))
MeshVertexPosition(-10, 0, -10)
MeshVertexColor(RGB(255,0,0))
FinishMesh(#False)
SetMeshMaterial(0, MaterialID(0))
Plane = CreateNode(#PB_Any, -40, 0, 0)
AttachNodeObject(Plane, MeshID(0))
;- Mesh Stars
CreateMesh(1, #PB_Mesh_PointList, #False)
For i = 0 To 10000
MeshVertexPosition(Random(200)-100, Random(200)-100, Random(200)-100)
MeshVertexColor(RGB(255,255,0))
Next i
FinishMesh(#False)
SetMeshMaterial(1, MaterialID(0))
Stars = CreateNode(#PB_Any)
AttachNodeObject(Stars, MeshID(1))
;- Mesh Box
CreateMesh(2, #PB_Mesh_LineStrip, #False)
MeshVertexPosition(-10, -10, -10)
MeshVertexPosition(-10, -10, 10)
MeshVertexPosition( 10, -10, 10)
MeshVertexPosition( 10, -10, -10)
MeshVertexPosition(-10, -10, -10)
AddSubMesh(#PB_Mesh_LineStrip)
MeshVertexPosition(-10, 10, -10)
MeshVertexPosition(-10, 10, 10)
MeshVertexPosition( 10, 10, 10)
MeshVertexPosition( 10, 10, -10)
MeshVertexPosition(-10, 10, -10)
AddSubMesh(#PB_Mesh_LineList)
MeshVertexPosition(-10, -10, -10)
MeshVertexPosition(-10, 10, -10)
MeshVertexPosition(-10, -10, 10)
MeshVertexPosition(-10, 10, 10)
MeshVertexPosition( 10, -10, 10)
MeshVertexPosition( 10, 10, 10)
MeshVertexPosition( 10, -10, -10)
MeshVertexPosition( 10, 10, -10)
FinishMesh(#False)
SetMeshMaterial(2, MaterialID(0))
Box = CreateNode(#PB_Any, 40, 0, 0)
AttachNodeObject(Box, MeshID(2))
;- Mesh Grid
CreateMesh(3, #PB_Mesh_LineList, #False)
For i=0 To 20
MeshVertexPosition(-20, 0, (i-10)*-2)
MeshVertexColor(RGB(55,155,255))
MeshVertexPosition(20, 0, (i-10)*-2)
MeshVertexColor(RGB(55,155,255))
Next
For i=0 To 20
MeshVertexPosition((i-10)*-2, 0, -20)
MeshVertexColor(RGB(255,155,55))
MeshVertexPosition((i-10)*-2, 0, 20)
MeshVertexColor(RGB(255,155,55))
Next
FinishMesh(#False)
SetMeshMaterial(3, MaterialID(0))
Grid = CreateNode(#PB_Any, 0, 0, 0)
AttachNodeObject(Grid, MeshID(3))
;- Mesh Plane (using MeshIndex)
CreateMesh(4, #PB_Mesh_LineStrip, #False)
; Define vertex position of index 0..3
MeshVertexPosition(-10, 0, -10)
MeshVertexPosition(-10, 0, 10)
MeshVertexPosition( 10, 0, 10)
MeshVertexPosition( 10, 0, -10)
; Define usage of vertices by refering To the indexes
MeshIndex(0)
MeshIndex(1)
MeshIndex(2)
MeshIndex(3)
MeshIndex(0)
FinishMesh(#False)
SetMeshMaterial(4, MaterialID(0))
Plane2 = CreateNode(#PB_Any, 0, 30, 0)
AttachNodeObject(Plane2, MeshID(4))
;- Mesh Box (using MeshIndex)
CreateMesh(5, #PB_Mesh_LineList, #False)
; Define vertex position of index 0..7
MeshVertexPosition(-10, -10, -10)
MeshVertexPosition(-10, -10, 10)
MeshVertexPosition( 10, -10, 10)
MeshVertexPosition( 10, -10, -10)
MeshVertexPosition(-10, 10, -10)
MeshVertexPosition(-10, 10, 10)
MeshVertexPosition( 10, 10, 10)
MeshVertexPosition( 10, 10, -10)
; Define usage of vertices by refering To the indexes
MeshIndex(0)
MeshIndex(1)
MeshIndex(1)
MeshIndex(2)
MeshIndex(2)
MeshIndex(3)
MeshIndex(0)
MeshIndex(3)
MeshIndex(4)
MeshIndex(5)
MeshIndex(5)
MeshIndex(6)
MeshIndex(6)
MeshIndex(7)
MeshIndex(4)
MeshIndex(7)
MeshIndex(0)
MeshIndex(4)
MeshIndex(1)
MeshIndex(5)
MeshIndex(2)
MeshIndex(6)
MeshIndex(3)
MeshIndex(7)
FinishMesh(#False)
SetMeshMaterial(5, MaterialID(0))
Box2 = CreateNode(#PB_Any, 0, -30, 0)
AttachNodeObject(Box2, MeshID(5))
;-Camera
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 40, 150, #PB_Absolute)
CameraFOV(0, 40)
CameraLookAt(0, NodeX(Grid), NodeY(Grid), NodeZ(Grid))
CameraBackColor(0, RGB(0, 0, 40))
;-Light
CreateLight(0, RGB(255,255,255), -10, 60, 10)
AmbientColor(RGB(90, 90, 90))
Repeat
Screen3DEvents()
ExamineKeyboard()
RotateNode(Plane, 0.3, -0.3, -0.3, #PB_Relative)
RotateNode(Stars, 0.1, 0.1, 0.1, #PB_Relative)
RotateNode(Box, 0.3, 0.3, 0.3, #PB_Relative)
RotateNode(Grid, 0.3, 0.3, 0.3, #PB_Relative)
RotateNode(Plane2, 0.3, -0.3, -0.3, #PB_Relative)
RotateNode(Box2, 0.3, 0.3, 0.3, #PB_Relative)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf
End
Please correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
Re: CreateMesh, FinishMesh - Type, Mode?
i haven't seen the meshmanual2.pb before, i admit it is fantastic, a surreal astro effect, and a subject for the study. thanks
Re: CreateMesh, FinishMesh - Type, Mode?
thx for examples
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module