ソースを参照

MeshViewer : Store EasyMeshes as Pointer.

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 11年前
コミット
7d93ea60d7
1個のファイルの変更12行の追加10行の削除
  1. +12
    -10
      test/meshviewer.cpp

+ 12
- 10
test/meshviewer.cpp ファイルの表示

@@ -268,8 +268,8 @@ public:
//Target List Setup
Array<vec3> target_list;
if (m_meshes.Count() && m_mesh_id >= 0)
for (int i = 0; i < m_meshes[m_mesh_id].GetVertexCount(); i++)
target_list << (m_mat * mat4::translate(m_meshes[m_mesh_id].GetVertexLocation(i))).v3.xyz;
for (int i = 0; i < m_meshes[m_mesh_id]->GetVertexCount(); i++)
target_list << (m_mat * mat4::translate(m_meshes[m_mesh_id]->GetVertexLocation(i))).v3.xyz;

//--
//Update mesh screen location - Get the Min/Max needed
@@ -337,9 +337,11 @@ public:
if (m_mesh_id == m_meshes.Count() - 1)
m_mesh_id++;
//Create a new mesh
EasyMesh tmp;
if (tmp.Compile(mesh.C()))
EasyMesh* tmp = new EasyMesh();
if (tmp->Compile(mesh.C()))
m_meshes.Push(tmp);
else
delete(tmp);
}
}

@@ -437,20 +439,20 @@ public:
for (int i = 0; i < m_meshes.Count(); i++)
{
{
if (m_meshes[i].GetMeshState() == MeshRender::NeedConvert)
if (m_meshes[i]->GetMeshState() == MeshRender::NeedConvert)
{
#if WITH_TEXTURE
m_meshes[i].MeshConvert(new DefaultShaderData(((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
m_meshes[i]->MeshConvert(new DefaultShaderData(((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
(1 << VertexUsage::Color) | (1 << VertexUsage::TexCoord)),
m_texture_shader, true));
#else
m_meshes[i].MeshConvert();
m_meshes[i]->MeshConvert();
#endif //WITH_TEXTURE
}
mat4 save_proj = m_camera->GetProjection();
float j = -(float)(m_meshes.Count() - (i + 1)) + (-m_mesh_id1 + (float)(m_meshes.Count() - 1));

if (m_meshes[i].GetMeshState() > MeshRender::NeedConvert)
if (m_meshes[i]->GetMeshState() > MeshRender::NeedConvert)
{
mat4 new_proj =
//Y object Offset
@@ -466,7 +468,7 @@ public:
//Camera projection
save_proj;
m_camera->SetProjection(new_proj);
m_meshes[i].Render(m_mat);
m_meshes[i]->Render(m_mat);
g_renderer->Clear(ClearMask::Depth);
}
m_camera->SetProjection(save_proj);
@@ -499,7 +501,7 @@ private:
//Mesh infos
int m_mesh_id;
float m_mesh_id1;
Array<EasyMesh> m_meshes;
Array<EasyMesh*> m_meshes;

//File data
String m_file_name;


読み込み中…
キャンセル
保存