@@ -72,6 +72,7 @@ test/xolotl/xolotl | |||
tools/make-font | |||
tutorial/01_triangle | |||
tutorial/02_cube | |||
tutorial/05_easymesh | |||
tutorial/08_fbo | |||
tutorial/11_fractal | |||
# Our data |
@@ -51,6 +51,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "02_cube", "..\..\tutorial\0 | |||
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA} = {9E62F2FE-3408-4EAE-8238-FD84238CEEDA} | |||
EndProjectSection | |||
EndProject | |||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "05_easymesh", "..\..\tutorial\05_easymesh.vcxproj", "{1C5B8702-290C-42DA-AA9E-671348F5B747}" | |||
ProjectSection(ProjectDependencies) = postProject | |||
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA} = {9E62F2FE-3408-4EAE-8238-FD84238CEEDA} | |||
EndProjectSection | |||
EndProject | |||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "11_fractal", "..\..\tutorial\11_fractal.vcxproj", "{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}" | |||
ProjectSection(ProjectDependencies) = postProject | |||
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA} = {9E62F2FE-3408-4EAE-8238-FD84238CEEDA} | |||
@@ -0,0 +1,87 @@ | |||
// | |||
// Lol Engine - EasyMesh tutorial | |||
// | |||
// Copyright: (c) 2011-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 "core.h" | |||
using namespace std; | |||
using namespace lol; | |||
#if USE_SDL && defined __APPLE__ | |||
# include <SDL_main.h> | |||
#endif | |||
class EasyMeshTutorial : public WorldEntity | |||
{ | |||
public: | |||
EasyMeshTutorial() | |||
{ | |||
m_angle = 0; | |||
m_mesh.Compile("sc#e94 scb#964 [acg10 5 8 8 2 2 0.1 0]"); | |||
m_camera = new Camera(vec3(0.f, 600.f, 0.f), | |||
vec3(0.f, 0.f, 0.f), | |||
vec3(0, 1, 0)); | |||
m_camera->SetPerspective(70.f, 640.f, 480.f, .1f, 1000.f); | |||
m_camera->SetTarget(vec3(0.f)); | |||
m_camera->SetPosition(vec3(-20.f, 20.f, 0.f)); | |||
Ticker::Ref(m_camera); | |||
m_ready = false; | |||
} | |||
virtual void TickGame(float seconds) | |||
{ | |||
WorldEntity::TickGame(seconds); | |||
m_angle += seconds * 45.0f; | |||
mat4 anim = mat4::rotate(m_angle, vec3(0, 1, 0)); | |||
mat4 model = mat4::translate(vec3(0, 0, 0)); | |||
m_matrix = model * anim; | |||
} | |||
virtual void TickDraw(float seconds) | |||
{ | |||
WorldEntity::TickDraw(seconds); | |||
if (!m_ready) | |||
{ | |||
m_mesh.MeshConvert(); | |||
m_ready = true; | |||
} | |||
Video::SetClearColor(vec4(0.0f, 0.0f, 0.0f, 1.0f)); | |||
m_mesh.Render(m_matrix); | |||
} | |||
private: | |||
float m_angle; | |||
mat4 m_matrix; | |||
EasyMesh m_mesh; | |||
Camera *m_camera; | |||
bool m_ready; | |||
}; | |||
int main(int argc, char **argv) | |||
{ | |||
Application app("Tutorial 5: EasyMesh", ivec2(640, 480), 60.0f); | |||
new EasyMeshTutorial(); | |||
app.Run(); | |||
return EXIT_SUCCESS; | |||
} | |||
@@ -0,0 +1,65 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<ItemGroup Label="ProjectConfigurations"> | |||
<ProjectConfiguration Include="Debug|PS3"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>PS3</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|Win32"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>Win32</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|x64"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>x64</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|Xbox 360"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>Xbox 360</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|PS3"> | |||
<Configuration>Release</Configuration> | |||
<Platform>PS3</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|Win32"> | |||
<Configuration>Release</Configuration> | |||
<Platform>Win32</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|x64"> | |||
<Configuration>Release</Configuration> | |||
<Platform>x64</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|Xbox 360"> | |||
<Configuration>Release</Configuration> | |||
<Platform>Xbox 360</Platform> | |||
</ProjectConfiguration> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClCompile Include="05_easymesh.cpp" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="$(SolutionDir)\..\..\src\lolcore.vcxproj"> | |||
<Project>{9e62f2fe-3408-4eae-8238-fd84238ceeda}</Project> | |||
</ProjectReference> | |||
</ItemGroup> | |||
<PropertyGroup Label="Globals"> | |||
<ProjectGuid>{1c5b8702-290c-42da-aa9e-671348f5b747}</ProjectGuid> | |||
<ConfigurationType>Application</ConfigurationType> | |||
<Keyword>Win32Proj</Keyword> | |||
</PropertyGroup> | |||
<Import Project="$(SolutionDir)\Lol.Core.Config.props" /> | |||
<ImportGroup Label="ExtensionSettings"> | |||
<Import Project="$(SolutionDir)\Lol.Fx.props" /> | |||
</ImportGroup> | |||
<ImportGroup Label="PropertySheets"> | |||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |||
<Import Project="$(SolutionDir)\Lol.Core.Vars.props" /> | |||
</ImportGroup> | |||
<PropertyGroup Label="UserMacros" /> | |||
<Import Project="$(SolutionDir)\Lol.Core.Rules.props" /> | |||
<ItemDefinitionGroup /> | |||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |||
<ImportGroup Label="ExtensionTargets"> | |||
<Import Project="$(SolutionDir)\Lol.Fx.targets" /> | |||
</ImportGroup> | |||
</Project> |
@@ -14,7 +14,7 @@ SUFFIXES = .lolfx | |||
.lolfx.o: | |||
$(LOLFX_BUILD) | |||
noinst_PROGRAMS = 01_triangle 02_cube 08_fbo 11_fractal | |||
noinst_PROGRAMS = 01_triangle 02_cube 05_easymesh 08_fbo 11_fractal | |||
01_triangle_SOURCES = 01_triangle.cpp 01_triangle.lolfx | |||
01_triangle_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ | |||
@@ -26,6 +26,11 @@ noinst_PROGRAMS = 01_triangle 02_cube 08_fbo 11_fractal | |||
02_cube_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@ @PIPI_LIBS@ | |||
02_cube_DEPENDENCIES = $(top_builddir)/src/liblol.a | |||
05_easymesh_SOURCES = 05_easymesh.cpp | |||
05_easymesh_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ | |||
05_easymesh_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@ @PIPI_LIBS@ | |||
05_easymesh_DEPENDENCIES = $(top_builddir)/src/liblol.a | |||
08_fbo_SOURCES = 08_fbo.cpp 08_fbo.lolfx | |||
08_fbo_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ | |||
08_fbo_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@ @PIPI_LIBS@ | |||