AddMesh bug or engine limitation?

BlitzMax Forums/MiniB3D Module/AddMesh bug or engine limitation?

IceVAN(Posted 2007) [#1]
Hello

Try this code:

Import sidesign.minib3d

Graphics3D 800,600,32,0

camera=CreateCamera()
PositionEntity camera,0,0,-15

light=CreateLight()
RotateEntity light,90,0,0


cr=CreateBrush(255,0,0)
BrushBlend cr,3

centro=CreateSphere(4)
PaintMesh centro,cr

c=CreateCube()
PaintMesh c,cr
ScaleMesh c,.25,.25,.25

For y#=-5.0 To 5.0 Step 1.0
For x#=-5.0 To 5.0 Step 1.0
For z#=-5.0 To 5.0 Step 1.0
PositionMesh c,x#,y#,z#
AddMesh c,centro
PositionMesh c,-x#,-y#,-z#
Next
Next
Next
FreeEntity c

While Not KeyDown(KEY_ESCAPE)
TurnEntity centro,.3,-.2,.1
RenderWorld
Flip
Wend

End




And now Try this other one:




Import sidesign.minib3d

Graphics3D 800,600,32,0

camera=CreateCamera()
PositionEntity camera,0,0,-15

light=CreateLight()
RotateEntity light,90,0,0


cr=CreateBrush(255,0,0)
BrushBlend cr,3

centro=CreateSphere(4)
PaintMesh centro,cr

c=CreateSphere()
PaintMesh c,cr
ScaleMesh c,.25,.25,.25

For y#=-5.0 To 5.0 Step 1.0
For x#=-5.0 To 5.0 Step 1.0
For z#=-5.0 To 5.0 Step 1.0
PositionMesh c,x#,y#,z#
AddMesh c,centro
PositionMesh c,-x#,-y#,-z#
Next
Next
Next
FreeEntity c

While Not KeyDown(KEY_ESCAPE)
TurnEntity centro,.3,-.2,.1
RenderWorld
Flip
Wend

End



The first code work well. One array of cubes turn on the screen.
But, in the second code the array of spheres is broken.

I believe that the vertices of mesh don't move well.

Somebody knows what happens?

Greetings.


IceVAN(Posted 2007) [#2]
Hello

I Finish reading in the aid online this:

DJWoodgate (Posted 2 years ago)
Something else to be aware of is that any surfaces with the same brush attributes, such as color and texture will be merged.

Unfortunately there is currently no check that the maximum number of vertices for a surface have been exceeded. If this occurs it will typically result in a memory access violation at renderworld. Opinions on the exact maximum number of verts vary, but you will be safe up to 32k verts and probably quite some way beyond.

(I believe that the max number of verts should be 64k based on an unsigned short which is used by the tri list to index into the vert list but my guess is the way memory is assigned to the vert list makes it unlikely that this exact number is ever achieved.)

Ideally of course blitz should create a new surface if the total number of verts in both surfaces would exceed the maximum, but for it to do that it needs to determine what the maximum number of verts for a surface is in the first place, which seems a tad uncertain at the moment.



MiniB3D also has that limitation/bug?
Is possible to be fixed it?

Greetings.


klepto2(Posted 2007) [#3]
The Vertex or Triangle limitations in the standard version is 65535 because minib3d uses Shorts to store the triangles. My extended Verison uses ints so in fact there could be (theoretically) 2147483647 triangles.

The the direct answer to your question is:
Yes the standard Version is limited to 65535 Triangles.


bradford6(Posted 2007) [#4]
I used to store triangles in my shorts but it just got to be so uncomfortable.

(could not resist)


Gavin Beard(Posted 2007) [#5]
@Bradford6 - LOL