Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualuglybdavis

Posted 25 June 2013 - 10:56 PM

You should look at a 3D format like collada. Maybe milkshape would be easier to start with.

It's a tad harder, but assimp is interesting to work with, definateley has good data layout.

 

You will save yourself a LOT of toruble by seperating a mesh into mesh data (vertex soup), submesh data (indices into the soup), skeleton data and animation data. Assuming at some point you want to animate these things.

struct MeshData {
    // Positions, normals, uv's basically one big mesh soup
    unsigned int m_nVertexBuffer;
};

struct SubmeshData {
    // Just indices into the mesh soup
    unsigned int m_nIndexBuffer;
    unsigned int m_nMaterialIndex; // Indexes into mesh classes materials
};

struct Mesh { // Tough, i'd call this 'struct Model'
    MeshData mesh;
    std::vector<SubmeshData> submeshes;
    SkeletonData skeleton;
    std::vector<ClipData> animations;
    std::vector<Material> materials; // All the materials submeshes may use
    // Materials are shaders with some way of setting uniform data.
};

Rendering would be something like:

void RenderMesh(Mesh& mesh) {
   mesh.BindVertexBuffer();
   for (int i = 0; i < mesh.submeshes; ++i) {
      Submesh& submesh = mesh.submeshes[i];
      submesh.BindMaterial();
      submesh.DrawIndexBuffer();
      submesh.UnbindMaterial();
   }
   mesh.UnbindVertexBuffer();
}

Keep in mind, there is no logic up there. It's all data! you would also need something to represent the current animation state. Also, vbo's are useful when animating on the gpu, you will need to hold on to vertex data for cpu animation.

 

Edit: Did not read your post about needing to traverse triangles from outside, sorry.


#5uglybdavis

Posted 25 June 2013 - 10:55 PM

You should look at a 3D format like collada. Maybe milkshape would be easier to start with.

It's a tad harder, but assimp is interesting to work with, definateley has good data layout.

 

You will save yourself a LOT of toruble by seperating a mesh into mesh data (vertex soup), submesh data (indices into the soup), skeleton data and animation data. Assuming at some point you want to animate these things.

struct MeshData {
    // Positions, normals, uv's basically one big mesh soup
    unsigned int m_nVertexBuffer;
};

struct SubmeshData {
    // Just indices into the mesh soup
    unsigned int m_nIndexBuffer;
    unsigned int m_nMaterialIndex; // Indexes into mesh classes materials
};

struct Mesh { // Tough, i'd call this 'struct Model'
    MeshData mesh;
    std::vector<SubmeshData> submeshes;
    SkeletonData skeleton;
    std::vector<ClipData> animations;
    std::vector<Material> materials; // All the materials submeshes may use
    // Materials are shaders with some way of setting uniform data.
};

Rendering would be something like:

void RenderMesh(Mesh& mesh) {
   mesh.BindVertexBuffer();
   for (int i = 0; i < mesh.submeshes; ++i) {
      Submesh& submesh = mesh.submeshes[i];
      submesh.BindMaterial();
      submesh.DrawIndexBuffer();
      submesh.UnbindMaterial();
   }
   mesh.UnbindVertexBuffer();
}

Keep in mind, there is no logic up there. It's all data! you would also need something to represent the current animation state. Also, vbo's are useful when animating on the gpu, you will need to hold on to vertex data for cpu animation.


#4uglybdavis

Posted 25 June 2013 - 10:54 PM

You should look at a 3D format like collada. Maybe milkshape would be easier to start with.

It's a tad harder, but assimp is interesting to work with, definateley has good data layout.

 

You will save yourself a LOT of toruble by seperating a mesh into mesh data (vertex soup), submesh data (indices into the soup), skeleton data and animation data. Assuming at some point you want to animate these things.

struct MeshData {
    // Positions, normals, uv's basically one big mesh soup
    unsigned int m_nVertexBuffer;
};

struct SubmeshData {
    // Just indices into the mesh soup
    unsigned int m_nIndexBuffer;
    unsigned int m_nMaterialIndex; // Indexes into mesh classes materials
};

struct Mesh {
    MeshData mesh;
    std::vector<SubmeshData> submeshes;
    SkeletonData skeleton;
    std::vector<ClipData> animations;
    std::vector<Material> materials; // All the materials submeshes may use
    // Materials are shaders with some way of setting uniform data.
};

Rendering would be something like:

void RenderMesh(Mesh& mesh) {
   mesh.BindVertexBuffer();
   for (int i = 0; i < mesh.submeshes; ++i) {
      Submesh& submesh = mesh.submeshes[i];
      submesh.BindMaterial();
      submesh.DrawIndexBuffer();
      submesh.UnbindMaterial();
   }
   mesh.UnbindVertexBuffer();
}

Keep in mind, there is no logic up there. It's all data! you would also need something to represent the current animation state. Also, vbo's are useful when animating on the gpu, you will need to hold on to vertex data for cpu animation.


#3uglybdavis

Posted 25 June 2013 - 10:54 PM

You should look at a 3D format like collada. Maybe milkshape would be easier to start with.

It's a tad harder, but assimp is interesting to work with, definateley has good data layout.

 

You will save yourself a LOT of toruble by seperating a mesh into mesh data (vertex soup), submesh data (indices into the soup), skeleton data and animation data. Assuming at some point you want to animate these things.

class MeshData {
    // Positions, normals, uv's basically one big mesh soup
    unsigned int m_nVertexBuffer;
};

class SubmeshData {
    // Just indices into the mesh soup
    unsigned int m_nIndexBuffer;
    unsigned int m_nMaterialIndex; // Indexes into mesh classes materials
};

class Mesh {
    MeshData mesh;
    std::vector<SubmeshData> submeshes;
    SkeletonData skeleton;
    std::vector<ClipData> animations;
    std::vector<Material> materials; // All the materials submeshes may use
    // Materials are shaders with some way of setting uniform data.
};

Rendering would be something like:

void RenderMesh(Mesh& mesh) {
   mesh.BindVertexBuffer();
   for (int i = 0; i < mesh.submeshes; ++i) {
      Submesh& submesh = mesh.submeshes[i];
      submesh.BindMaterial();
      submesh.DrawIndexBuffer();
      submesh.UnbindMaterial();
   }
   mesh.UnbindVertexBuffer();
}

Keep in mind, there is no logic up there. It's all data! you would also need something to represent the current animation state. Also, vbo's are useful when animating on the gpu, you will need to hold on to vertex data for cpu animation.


#2uglybdavis

Posted 25 June 2013 - 10:52 PM

You should look at a 3D format like collada. Maybe milkshape would be easier to start with.

It's a tad harder, but assimp is interesting to work with, definateley has good data layout.

 

You will save yourself a LOT of toruble by seperating a mesh into mesh data (vertex soup), submesh data (indices into the soup), skeleton data and animation data. Assuming at some point you want to animate these things.

class MeshData {
    // Positions, normals, uv's basically one big mesh soup
    unsigned int m_nVertexBuffer;
};

class SubmeshData {
    // Just indices into the mesh soup
    unsigned int m_nIndexBuffer;
};

class Mesh {
    MeshData mesh;
    std::vector<SubmeshData> submeshes;
    SkeletonData skeleton;
    std::vector<ClipData> animations;
};

Rendering would be something like:

void RenderMesh(Mesh& mesh) {
   mesh.BindVertexBuffer();
   for (int i = 0; i < mesh.submeshes; ++i) {
      Submesh& submesh = mesh.submeshes[i];
      submesh.BindMaterial();
      submesh.DrawIndexBuffer();
      submesh.UnbindMaterial();
   }
   mesh.UnbindVertexBuffer();
}

Keep in mind, there is no logic up there. It's all data! you would also need something to represent the current animation state. Also, vbo's are useful when animating on the gpu, you will need to hold on to vertex data for cpu animation.


#1uglybdavis

Posted 25 June 2013 - 10:49 PM

You should look at a 3D format like collada. Maybe milkshape would be easier to start with.

It's a tad harder, but assimp is interesting to work with, definateley has good data layout.

 

You will save yourself a LOT of toruble by seperating a mesh into mesh data (vertex soup), submesh data (indices into the soup), skeleton data and animation data. Assuming at some point you want to animate these things.

class MeshData {
    // Positions, normals, uv's basically one big mesh soup
    unsigned int m_nVertexBuffer;
};

class SubmeshData {
    // Just indices into the mesh soup
    unsigned int m_nIndexBuffer;
};

class Mesh {
    MeshData mesh;
    std::vector<SubmeshData> submeshes;
    SkeletonData skeleton;
    std::vector<ClipData> animations;
};

Keep in mind, there is no logic up there. It's all data! you would also need something to represent the current animation state. Also, vbo's are useful when animating on the gpu, you will need to hold on to vertex data for cpu animation.


PARTNERS