Quellcode durchsuchen

mesh: start working on mesh and submesh stuff.

legacy
Sam Hocevar sam vor 12 Jahren
Ursprung
Commit
4a6d092a74
7 geänderte Dateien mit 116 neuen und 1 gelöschten Zeilen
  1. +2
    -0
      src/Makefile.am
  2. +1
    -0
      src/core.h
  3. +1
    -1
      src/easymesh/easymesh.cpp
  4. +2
    -0
      src/lolcore.vcxproj
  5. +9
    -0
      src/lolcore.vcxproj.filters
  6. +50
    -0
      src/mesh/mesh.cpp
  7. +51
    -0
      src/mesh/mesh.h

+ 2
- 0
src/Makefile.am Datei anzeigen

@@ -63,6 +63,8 @@ liblol_a_SOURCES = \
generated/lolfx-parser.cpp generated/lolfx-parser.h \
generated/lolfx-scanner.cpp \
\
mesh/mesh.cpp mesh/mesh.h \
\
image/image.cpp image/image.h image/image-private.h \
image/codec/gdiplus-image.cpp \
image/codec/ios-image.cpp \


+ 1
- 0
src/core.h Datei anzeigen

@@ -120,6 +120,7 @@ static inline int isnan(float f)
#include "gpu/indexbuffer.h"
#include "gpu/vertexbuffer.h"
#include "gpu/framebuffer.h"
#include "mesh/mesh.h"
#include "image/image.h"
#include "application/application.h"
#include "easymesh/easymesh.h"


+ 1
- 1
src/easymesh/easymesh.cpp Datei anzeigen

@@ -120,8 +120,8 @@ void EasyMesh::Render(mat4 const &model, float damage)
m_gpu.shader->SetUniform(m_gpu.proj, Scene::GetDefault()->GetProjMatrix());
m_gpu.shader->SetUniform(m_gpu.normalmat, normalmat);
m_gpu.shader->SetUniform(m_gpu.damage, damage);
m_gpu.vdecl->SetStream(m_gpu.vbo, m_gpu.coord, m_gpu.norm, m_gpu.color);
m_gpu.vdecl->Bind();
m_gpu.vdecl->SetStream(m_gpu.vbo, m_gpu.coord, m_gpu.norm, m_gpu.color);
m_gpu.ibo->Bind();
m_gpu.vdecl->DrawIndexedElements(MeshPrimitive::Triangles,
0, 0, m_gpu.vertexcount,


+ 2
- 0
src/lolcore.vcxproj Datei anzeigen

@@ -275,6 +275,7 @@
<ClCompile Include="math\real.cpp" />
<ClCompile Include="math\trig.cpp" />
<ClCompile Include="math\vector.cpp" />
<ClCompile Include="mesh\mesh.cpp" />
<ClCompile Include="platform.cpp" />
<ClCompile Include="platform\d3d9\d3d9input.cpp" />
<ClCompile Include="platform\ps3\ps3app.cpp" />
@@ -589,6 +590,7 @@
<ClInclude Include="lol\math\remez.h" />
<ClInclude Include="lol\math\vector.h" />
<ClInclude Include="lol\unit.h" />
<ClInclude Include="mesh\mesh.h" />
<ClInclude Include="map.h" />
<ClInclude Include="numeric.h" />
<ClInclude Include="platform.h" />


+ 9
- 0
src/lolcore.vcxproj.filters Datei anzeigen

@@ -26,6 +26,9 @@
<Filter Include="src\math">
<UniqueIdentifier>{2caadbda-b9f1-446d-bbd2-55c959db342c}</UniqueIdentifier>
</Filter>
<Filter Include="src\mesh">
<UniqueIdentifier>{1eaa8df5-7a31-4358-a1e9-0e265de6ed49}</UniqueIdentifier>
</Filter>
<Filter Include="src\gpu">
<UniqueIdentifier>{ec9b94fc-c716-4ef2-9c3b-c7f3447574b0}</UniqueIdentifier>
</Filter>
@@ -94,6 +97,9 @@
<ClCompile Include="math\vector.cpp">
<Filter>src\math</Filter>
</ClCompile>
<ClCompile Include="mesh\mesh.cpp">
<Filter>src\mesh</Filter>
</ClCompile>
<ClCompile Include="gpu\shader.cpp">
<Filter>src\gpu</Filter>
</ClCompile>
@@ -672,6 +678,9 @@
<ClInclude Include="lol\unit.h">
<Filter>src\lol</Filter>
</ClInclude>
<ClInclude Include="mesh\mesh.h">
<Filter>src\mesh</Filter>
</ClInclude>
<ClInclude Include="gpu\shader.h">
<Filter>src\gpu</Filter>
</ClInclude>


+ 50
- 0
src/mesh/mesh.cpp Datei anzeigen

@@ -0,0 +1,50 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

#if defined HAVE_CONFIG_H
# include "config.h"
#endif

#include <cstring>
#include <cstdlib>

#include "core.h"

namespace lol
{

Mesh::Mesh()
{
}

Mesh::~Mesh()
{
}

void Mesh::Render(mat4 const &model)
{
for (int i = 0; i < m_submeshes.Count(); ++i)
m_submeshes[i]->Render(model);
}

SubMesh::SubMesh()
{
}

SubMesh::~SubMesh()
{
}

void SubMesh::Render(mat4 const &model)
{
}

} /* namespace lol */


+ 51
- 0
src/mesh/mesh.h Datei anzeigen

@@ -0,0 +1,51 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

//
// The Mesh class
// --------------
//

#if !defined __MESH_MESH_H__
#define __MESH_MESH_H__

namespace lol
{

class SubMesh
{
public:
SubMesh();
~SubMesh();

void Render(mat4 const &model);

private:
Array<vec3> m_vertices;
Array<vec2> m_uvs;
Array<vec3> m_normals;
};

class Mesh
{
public:
Mesh();
~Mesh();

void Render(mat4 const &model);

private:
Array<SubMesh *> m_submeshes;
};

} /* namespace lol */

#endif /* __MESH_MESH_H__ */


Laden…
Abbrechen
Speichern