Jump to content

VertexBuffer, PositionKind


satguru
 Share

Recommended Posts

In this playground I create a cube then get its vertices data

https://www.babylonjs-playground.com/#LQDMJ6

When I get the vertices data using 

box.getVerticesData(BABYLON.VertexBuffer.PositionKind);
I get an array containing 72 elements
 
How come?
A cube has 8 vertices
Shouldn't the array have only 8*3 = 24 elements ?
 
Same thing with NormalKind. I get an array with 72 elements!
Link to comment
Share on other sites

A cube has 24 vertices and not 8 (so 24 * 3 = 72 floats).

Why 24 ? because vertices aren't shared between the box sides. This is necessary to hold the normals what are also not shared ... in order to get 3 normals per box vertices, each one being orthogonal to a different box side.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...