• you mean something like this?

    x0 = CSng(0 + Parts.Item(id).OffsetX - CDbl(Parts.Item(id).ShapeBoxX(0)) - P1X)
    y0 = CSng(0 - Parts.Item(id).OffsetY + CDbl(Parts.Item(id).ShapeBoxY(0)) + P1Y)
    z0 = CSng(0 + Parts.Item(id).OffsetZ - CDbl(Parts.Item(id).ShapeBoxZ(0)) - P1Z)

    x1 = CSng(0 + CInt(Parts.Item(id).DimX) + Parts.Item(id).OffsetX + CDbl(Parts.Item(id).ShapeBoxX(1)) + P2X + DimX)
    y1 = CSng(0 - Parts.Item(id).OffsetY + CDbl(Parts.Item(id).ShapeBoxY(1)) + P2Y)
    z1 = CSng(0 + Parts.Item(id).OffsetZ - CDbl(Parts.Item(id).ShapeBoxZ(1)) - P2Z)

    x2 = CSng(0 + CInt(Parts.Item(id).DimX) + Parts.Item(id).OffsetX + CDbl(Parts.Item(id).ShapeBoxX(2)) + P3X + DimX)
    y2 = CSng(0 - Parts.Item(id).OffsetY + CDbl(Parts.Item(id).ShapeBoxY(2)) + P3Y)
    z2 = CSng(0 + CInt(Parts.Item(id).DimZ) + Parts.Item(id).OffsetZ + CDbl(Parts.Item(id).ShapeBoxZ(2)) + P3Z + DimZ)

    x3 = CSng(0 + Parts.Item(id).OffsetX - CDbl(Parts.Item(id).ShapeBoxX(3)) - P4X)
    y3 = CSng(0 - Parts.Item(id).OffsetY + CDbl(Parts.Item(id).ShapeBoxY(3)) + P4Y)
    z3 = CSng(0 + CInt(Parts.Item(id).DimZ) + Parts.Item(id).OffsetZ + CDbl(Parts.Item(id).ShapeBoxZ(3)) + P4Z + DimZ)

    x4 = CSng(0 + Parts.Item(id).OffsetX - CDbl(Parts.Item(id).ShapeBoxX(4)) - P5X)
    y4 = CSng(0 - CInt(Parts.Item(id).DimY) - Parts.Item(id).OffsetY - CDbl(Parts.Item(id).ShapeBoxY(4)) - P5Y + DimY)
    z4 = CSng(0 + Parts.Item(id).OffsetZ - CDbl(Parts.Item(id).ShapeBoxZ(4)) - P5Z)

    x5 = CSng(0 + CInt(Parts.Item(id).DimX) + Parts.Item(id).OffsetX + CDbl(Parts.Item(id).ShapeBoxX(5)) + P6X + DimX)
    y5 = CSng(0 - CInt(Parts.Item(id).DimY) - Parts.Item(id).OffsetY - CDbl(Parts.Item(id).ShapeBoxY(5)) - P6Y + DimY)
    z5 = CSng(0 + Parts.Item(id).OffsetZ - CDbl(Parts.Item(id).ShapeBoxZ(5)) - P6Z)

    x6 = CSng(0 + CInt(Parts.Item(id).DimX) + Parts.Item(id).OffsetX + CDbl(Parts.Item(id).ShapeBoxX(6)) + P7X + DimX)
    y6 = CSng(0 - CInt(Parts.Item(id).DimY) - Parts.Item(id).OffsetY - CDbl(Parts.Item(id).ShapeBoxY(6)) - P7Y + DimY)
    z6 = CSng(0 + CInt(Parts.Item(id).DimZ) + Parts.Item(id).OffsetZ + CDbl(Parts.Item(id).ShapeBoxZ(6)) + P7Z + DimZ)

    x7 = CSng(0 + Parts.Item(id).OffsetX - CDbl(Parts.Item(id).ShapeBoxX(7)) - P8X)
    y7 = CSng(0 - CInt(Parts.Item(id).DimY) - Parts.Item(id).OffsetY - CDbl(Parts.Item(id).ShapeBoxY(7)) - P8Y + DimY)
    z7 = CSng(0 + CInt(Parts.Item(id).DimZ) + Parts.Item(id).OffsetZ + CDbl(Parts.Item(id).ShapeBoxZ(7)) + P8Z + DimZ)

    these are the formulas to calculate the 8 corners of a box.
    - Offset = the offset of the part
    - Shapebox = the corner modifier
    - Dim = Dimension of the part
    - P1-P8 = modifier for mirroring, you can ignore them

    then i build the vertexes out of them and store them with the texture coords in a vbo, first coord point value, secound coord texture value

    New Vector3(z2, y2, x2),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY)), 0),
    New Vector3(z3, y3, x3),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY)), 0),
    New Vector3(z0, y0, x0),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z1, y1, x1),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z5, y5, x5),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY)), 0),
    New Vector3(z4, y4, x4),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY)), 0),
    New Vector3(z7, y7, x7),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z6, y6, x6),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z0, y0, x0),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z3, y3, x3),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z7, y7, x7),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),
    New Vector3(z4, y4, x4),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),
    New Vector3(z2, y2, x2),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z1, y1, x1),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z5, y5, x5),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),
    New Vector3(z6, y6, x6),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),
    New Vector3(z1, y1, x1),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z0, y0, x0),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z4, y4, x4),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),
    New Vector3(z5, y5, x5),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),
    New Vector3(z3, y3, x3),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z2, y2, x2),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ)), 0),
    New Vector3(z6, y6, x6),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimZ)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),
    New Vector3(z7, y7, x7),
    New Vector3(CSng((1 / PicWidth) * (Parts.Item(id).TextureX + Parts.Item(id).DimZ + Parts.Item(id).DimX + Parts.Item(id).DimZ + Parts.Item(id).DimX)), CSng((1 / PicHeight) * (Parts.Item(id).TextureY + Parts.Item(id).DimZ + Parts.Item(id).DimY)), 0),

    GL.GenBuffers(1, Parts.Item(id).VBO)
    GL.BindBuffer(BufferTarget.ArrayBuffer, Parts.Item(id).VBO)
    GL.BufferData(Of Vector3)(BufferTarget.ArrayBuffer, New IntPtr(vertices.Length * Vector3.SizeInBytes), vertices, BufferUsageHint.StaticDraw)
    GL.BindBuffer(BufferTarget.ArrayBuffer, 0)

    For drawing i call the vbo and display all 6 sides with the unique color or texture

    GL.Enable(EnableCap.Texture2D)
    GL.EnableClientState(ArrayCap.VertexArray)
    GL.EnableClientState(ArrayCap.TextureCoordArray)
    GL.BindBuffer(BufferTarget.ArrayBuffer, Parts.Item(id).VBO)
    GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes * 2, 0)
    GL.TexCoordPointer(3, TexCoordPointerType.Float, Vector3.SizeInBytes * 2, Vector3.SizeInBytes)

    GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill)
    GL.Color3(My.Settings.colorBox1)
    GL.DrawArrays(PrimitiveType.Quads, 0, 4)
    GL.Color3(My.Settings.colorBox2)
    GL.DrawArrays(PrimitiveType.Quads, 4, 4)
    GL.Color3(My.Settings.colorBox3)
    GL.DrawArrays(PrimitiveType.Quads, 8, 4)
    GL.Color3(My.Settings.colorBox4)
    GL.DrawArrays(PrimitiveType.Quads, 12, 4)
    GL.Color3(My.Settings.colorBox5)
    GL.DrawArrays(PrimitiveType.Quads, 16, 4)
    GL.Color3(My.Settings.colorBox6)
    GL.DrawArrays(PrimitiveType.Quads, 20, 4)
    1. View Reply
    2. View Thread →
    0
    0
    0
    0
    0
    0
    Post is under moderation
    Stream item published successfully. Item will now be visible on your stream.
Unable to load tooltip content.
 
Latest Forum Posts
 
Latest Blog Posts
 
User Online
 
User Menu