Needed engine3d internals info to build own SetMeshData() fu
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Needed engine3d internals info to build own SetMeshData() fu
Needed engine3d library internals info to perform custom Get/SetMeshData() function.
I mean,
wanted to know about the Mesh base memory and its size and structure after a mesh is created with CreateMesh(), CreateCube(), CreateCylinder(), etc.
THX!
I mean,
wanted to know about the Mesh base memory and its size and structure after a mesh is created with CreateMesh(), CreateCube(), CreateCylinder(), etc.
THX!
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
-
- Addict
- Posts: 2228
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Guy, how about using AddMeshVertex(x, y, z) and AddMeshFace(Vertex1, Vertex2, Vertex3)? SetMeshData was replaced by that and for GetMeshData ... just let a copy of the memory stay in your code.
bye,
Daniel
Daniel
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Don't want to just add but also to modify previously stablished mesh vertexes, faces, colors, etc. Modify its position relative to its node. But modify vertex properties, not submeshes properties like TransformMesh() does.DarkDragon wrote:Guy, how about using AddMeshVertex(x, y, z) and AddMeshFace(Vertex1, Vertex2, Vertex3)? Set-/GetMeshData was replaced by that.
TransformMesh() is not enough because it is no able to modify vertex position but complete meshes or submeshes.
Ans besides of that AddMeshVertex(x, y, z) and AddMeshFace(Vertex1, Vertex2, Vertex3),etc. are too slow if you want to real-timed modify or set up a complete big mesh in comparison with a 'copymemory' like command.
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
-
- Addict
- Posts: 2228
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Why don't you use Blender then? Or if it is for a model editing software: OpenGL or DirectX?Psychophanta wrote:Don't want to just add but also to modify previously stablished mesh vertexes, faces, colors, etc. Modify its position relative to its node. But modify vertex properties, not submeshes properties like TransformMesh() does.DarkDragon wrote:Guy, how about using AddMeshVertex(x, y, z) and AddMeshFace(Vertex1, Vertex2, Vertex3)? Set-/GetMeshData was replaced by that.
TransformMesh() is not enough because it is no able to modify vertex position but complete meshes or submeshes.
Ans besides of that AddMeshVertex(x, y, z) and AddMeshFace(Vertex1, Vertex2, Vertex3),etc. are too slow if you want to real-timed modify or set up a complete big mesh in comparison with a 'copymemory' like command.
bye,
Daniel
Daniel
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Because i want to do it via PB programming.DarkDragon wrote:Why don't you use Blender then? Or if it is for a model editing software: OpenGL or DirectX?
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
Re: Needed engine3d internals info to build own SetMeshData(
In the case of using static mesh it's OK, but the current PB mesh system is not suitable for Procedural morphing mesh generation.DarkDragon wrote:Why don't you use Blender then?
And this is the main problem with this current implementation.
Best regards.
Guimauve
-
- Addict
- Posts: 2228
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Procedural morphing mesh generation? You mean bone animation?! This is possible with Blender and PureBasic.Guimauve wrote:In the case of using static mesh it's OK, but the current PB mesh system is not suitable for Procedural morphing mesh generation.DarkDragon wrote:Why don't you use Blender then?
The spring ist made with it: http://www.youtube.com/watch?v=pW8CUhe-Rfg
LOD is also possible .. dunno what you want. Everything else is bad for the bottleneck if you aren't able to use geometry shaders (but you are with purebasic!).
bye,
Daniel
Daniel
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Is not that kind of animation Bradan, as i said there is no way to modify in realtime the vertex position.
For example,
do you remember this?
http://www.purebasic.fr/english/viewtop ... =12&t=8367
Well, it is for PB4.00 and in the newest PB release (PB4.60RC1) there is not possible to do that, is it?
For example,
do you remember this?
http://www.purebasic.fr/english/viewtop ... =12&t=8367
Well, it is for PB4.00 and in the newest PB release (PB4.60RC1) there is not possible to do that, is it?
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
-
- Addict
- Posts: 2228
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
I don't know what this code was about.Psychophanta wrote:Is not that kind of animation Bradan, as i said there is no way to modify in realtime the vertex position.
For example,
do you remember this?
http://www.purebasic.fr/english/viewtop ... =12&t=8367
Well, it is for PB4.00 and in the newest PB release (PB4.60RC1) there is not possible to do that, is it?
Create a new mesh, and store the data inside if you are too lazy for shaders.
bye,
Daniel
Daniel
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
You can always run it on PB4.00 and see.DarkDragon wrote:I don't know what this code was about.
That is just the "how to" i am asking for in the first post; store the full mesh data inside with a unique command.DarkDragon wrote:Create a new mesh, and store the data inside
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
-
- Addict
- Posts: 2228
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
How about this, then? It is as efficient as SetMeshData would be.Psychophanta wrote:That is just the "how to" i am asking for in the first post; store the full mesh data inside with a unique command.DarkDragon wrote:Create a new mesh, and store the data inside
Code: Select all
Macro Check(Status, Error, EndProgram = 1)
If Not Status
MessageRequester("ERROR", Error)
CompilerIf EndProgram
End
CompilerEndIf
EndIf
EndMacro
Structure MeshVertex
X.f
Y.f
Z.f
EndStructure
Structure MeshNormal
X.f
Y.f
Z.f
EndStructure
Structure MeshColor
RGB.l
EndStructure
Structure MeshUV
U.f
V.f
EndStructure
Structure MeshFace
V1.i
V2.i
V3.i
EndStructure
Procedure.i CreateMeshEx(Mesh.i, *PointerVertex.MeshVertex, *PointerColor.MeshColor, *PointerNormal.MeshNormal, *PointerUV.MeshUV, *PointerFace.MeshFace, Vertices.i, Faces.i)
Protected K.i
Protected MeshNumber.i
Protected Result.i = 0
If *PointerVertex = #Null Or *PointerFace = #Null
ProcedureReturn Result
EndIf
If Mesh = #PB_Any
MeshNumber = CreateMesh(Mesh)
Result = MeshNumber
Else
Result = CreateMesh(Mesh)
MeshNumber = Mesh
EndIf
If Result <> 0
AddSubMesh()
For K = 1 To Vertices
AddMeshVertex(*PointerVertex\X, *PointerVertex\Y, *PointerVertex\Z)
If *PointerColor <> #Null
MeshVertexColor(*PointerColor\RGB)
*PointerColor + SizeOf(MeshColor)
EndIf
If *PointerNormal <> #Null
MeshVertexNormal(*PointerNormal\X, *PointerNormal\Y, *PointerNormal\Z)
*PointerNormal + SizeOf(MeshNormal)
EndIf
If *PointerUV <> #Null
MeshVertexTextureCoordinate(*PointerUV\U, *PointerUV\V)
*PointerUV + SizeOf(MeshUV)
EndIf
*PointerVertex + SizeOf(MeshVertex)
Next K
For K = 1 To Faces
AddMeshFace(*PointerFace\V1, *PointerFace\V2, *PointerFace\V3)
*PointerFace + SizeOf(MeshFace)
Next K
FinishMesh()
EndIf
ProcedureReturn Result
EndProcedure
Check(InitEngine3D(), "InitEngine3D failed.")
Check(InitSprite(), "InitSprite failed.")
Check(InitKeyboard(), "InitKeyboard failed.")
Check(ExamineDesktops(), "ExamineDesktops failed.")
Check(OpenScreen(DesktopWidth(0), DesktopHeight(0), 32, "Test"), "OpenScreen failed.")
WorldShadows(#PB_Shadow_Modulative)
CreateTexture(0, 64, 64)
StartDrawing(TextureOutput(0))
Box(0, 0, 32, 32, RGB(0, 0, 255))
Box(32, 0, 32, 32, RGB(0, 255, 0))
Box(32, 32, 32, 32, RGB(255, 0, 0))
Box(0, 32, 32, 32, RGB(255, 255, 0))
StopDrawing()
CreateMaterial(0, TextureID(0))
CreateMeshEx(0, ?DataVertices, #Null, ?DataNormal, ?DataUV, ?DataFaces, 4, 2)
Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
CreateLight(0, RGB(255, 255, 255), 100.0, 0, 0)
LightSpecularColor(0, RGB(255, 0, 0))
Check(CreateCamera(0, 0, 0, 100, 100), "CreateCamera failed")
CameraLocate(0, 5, 5, -10)
CameraLookAt(0, 0, 0, 0)
Define Timer = ElapsedMilliseconds()
Define Mode = 0
Repeat
ClearScreen(0)
RenderWorld()
FlipBuffers()
If ElapsedMilliseconds() - Timer > 1000
If Mode = 0
CreateMeshEx(0, ?DataVertices2, #Null, ?DataNormal, ?DataUV2, ?DataFaces, 3, 1)
Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
Mode = 1
Else
CreateMeshEx(0, ?DataVertices, #Null, ?DataNormal, ?DataUV, ?DataFaces, 4, 2)
Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
Mode = 0
EndIf
Timer = ElapsedMilliseconds()
EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End
DataSection
DataVertices:
Data.f -0.5, 0.5, 0.0
Data.f 0.5, 0.5, 0.0
Data.f 0.5, -0.5, 0.0
Data.f -0.5, -0.5, 0.0
DataVertices2:
Data.f -0.75, 0.75, 0.0
Data.f 0.75, 0.75, 0.0
Data.f 0.75, -0.75, 0.0
Data.f -0.75, -0.75, 0.0
DataNormal:
Data.f 0.0, 0.0, 1.0
Data.f 0.0, 0.0, 1.0
Data.f 0.0, 0.0, 1.0
Data.f 0.0, 0.0, 1.0
DataUV:
Data.f 0.0, 0.0
Data.f 1.0, 0.0
Data.f 1.0, 1.0
Data.f 0.0, 1.0
DataUV2:
Data.f 1.0, 1.0
Data.f 0.0, 1.0
Data.f 0.0, 0.0
Data.f 1.0, 0.0
DataFaces:
Data.i 0, 1, 2
Data.i 0, 2, 3
EndDataSection
bye,
Daniel
Daniel
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Your program example does not work here.
Anyway you say efficient? are you crazy?
It is not an unique command! far of this it includes loops, so it is useless for almost anything!
Anyway you say efficient? are you crazy?
It is not an unique command! far of this it includes loops, so it is useless for almost anything!
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
-
- Addict
- Posts: 2228
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
I did not say it is efficient. I said it is same efficient as SetMeshData! GeometryPrograms FTW - they are the only way to go on with such things.Psychophanta wrote:Your program example does not work here.
Anyway you say efficient? are you crazy?
SetMeshData will load the full data again and again to the GPU, as vertex buffers are needed there.
Here it works. PB 4.60 RC 1 is required.
Sure, but you can convert your code to it, or are you really sooo lazy?Psychophanta wrote:It is not an unique command!
Copying memory will always be of Theta(n) runtime. My loops are all Theta(n).Psychophanta wrote:far of this it includes loops, so it is useless for almost anything!
bye,
Daniel
Daniel
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Can not test it because program is not able to open screen. The debugger does not complain but the screen is not open at all.
But i seriously doubt your function works as fast as SetMeshData() did.
But i seriously doubt your function works as fast as SetMeshData() did.
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
-
- Addict
- Posts: 2228
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Needed engine3d internals info to build own SetMeshData(
Then you may change this to a fixed resolution which works for you:Psychophanta wrote:Can not test it because program is not able to open screen. The debugger does not complain but the screen is not open at all.
Code: Select all
Check(ExamineDesktops(), "ExamineDesktops failed.")
Check(OpenScreen(DesktopWidth(0), DesktopHeight(0), 32, "Test"), "OpenScreen failed.")
Sure, what do you think does SetMeshData do? It copies the mesh to the GPU again (this is what FinishMesh does at the end). It isn't very different from this and it may only be a constant term less in time. As I said already: you should create your mesh on GPU with geometry shaders, not on CPU.Psychophanta wrote:But i seriously doubt your function works as fast as SetMeshData() did.
bye,
Daniel
Daniel