Quellcode durchsuchen

Added nacl_phystest to test physic compatibility with nacl.

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> vor 11 Jahren
Ursprung
Commit
05c476c22a
6 geänderte Dateien mit 320 neuen und 1 gelöschten Zeilen
  1. +23
    -0
      build/vs2010/Lol.sln
  2. +8
    -1
      test/Makefile.am
  3. +121
    -0
      test/nacl_phystest.cpp
  4. +61
    -0
      test/nacl_phystest.h
  5. +87
    -0
      test/nacl_phystest.vcxproj
  6. +20
    -0
      test/nacl_phystest.vcxproj.filters

+ 23
- 0
build/vs2010/Lol.sln Datei anzeigen

@@ -158,6 +158,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "06_sprite", "..\..\demos\tu
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "voxel", "..\..\people\benlitz\private\voxel\voxel.vcxproj", "{52493826-AC00-470B-A745-4F602529B3B0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nacl_phystest", "..\..\test\nacl_phystest.vcxproj", "{EE203B88-44CF-4859-9D42-7A1F43FECB53}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1007,6 +1009,26 @@ Global
{52493826-AC00-470B-A745-4F602529B3B0}.Release|x64.ActiveCfg = Release|x64
{52493826-AC00-470B-A745-4F602529B3B0}.Release|x64.Build.0 = Release|x64
{52493826-AC00-470B-A745-4F602529B3B0}.Release|Xbox 360.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|Any CPU.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|Mixed Platforms.Build.0 = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|ORBIS.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|PS3.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|Win32.ActiveCfg = Debug|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|Win32.Build.0 = Debug|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|x64.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|x64.Build.0 = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Debug|Xbox 360.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|Any CPU.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|Mixed Platforms.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|Mixed Platforms.Build.0 = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|ORBIS.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|PS3.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|Win32.ActiveCfg = Release|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|Win32.Build.0 = Release|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|x64.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|x64.Build.0 = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB53}.Release|Xbox 360.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1031,6 +1053,7 @@ Global
{80F81C11-8DA2-4990-91CB-9807783BA46E} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{EE203B88-44CF-4859-9D42-7A1F43FECB52} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{7CE9FE12-E4AB-4A22-90D4-2C15F0C30D4E} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{EE203B88-44CF-4859-9D42-7A1F43FECB53} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{E74CF679-CA2A-47E9-B1F4-3779D6AC6B04} = {E5C5E320-C077-4362-9A3F-3920C6447601}
{F7D4A671-612F-4FF4-883F-2097697694B7} = {E5C5E320-C077-4362-9A3F-3920C6447601}
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}


+ 8
- 1
test/Makefile.am Datei anzeigen

@@ -6,7 +6,7 @@ SUBDIRS = math sandbox xolotl
bench: benchsuite$(EXEEXT)
./benchsuite$(EXEEXT)

noinst_PROGRAMS = benchsuite $(testsuite) btphystest meshviewer
noinst_PROGRAMS = benchsuite $(testsuite) btphystest nacl_phystest meshviewer

TESTS = $(testsuite)

@@ -50,6 +50,13 @@ btphystest_LDFLAGS += \
-s TOTAL_MEMORY=$(shell expr 32 '*' 1024 '*' 1024)
endif

nacl_phystest_SOURCES = \
nacl_phystest.cpp nacl_phystest.h
nacl_phystest_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/bullet \
-DHAVE_PHYS_USE_BULLET
nacl_phystest_DEPENDENCIES = @LOL_DEPS@
nacl_phystest_LDFLAGS = $(AM_LDFLAGS)

meshviewer_SOURCES = meshviewer.cpp \
shinymvtexture.lolfx shinyfur.lolfx
meshviewer_CPPFLAGS = $(AM_CPPFLAGS)


+ 121
- 0
test/nacl_phystest.cpp Datei anzeigen

@@ -0,0 +1,121 @@
//
// BtPhysTest
//
// Copyright: (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// (c) 2012-2013 Sam Hocevar <sam@hocevar.net>
//

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

#include "core.h"
#include "loldebug.h"

using namespace lol;

#ifndef HAVE_PHYS_USE_BULLET
#define HAVE_PHYS_USE_BULLET
#endif /* HAVE_PHYS_USE_BULLET */

//#include "physics/lolphysics.h"
//#include "physics/easyphysics.h"

#include "nacl_phystest.h"

//using namespace lol::phys;

int gNumObjects = 64;

Nacl_PhysTest::Nacl_PhysTest(bool editor)
{
/* Register an input controller for the keyboard */
m_controller = new Controller(KEY_MAX, 0);
m_controller->GetKey(KEY_MOVE_FORWARD).Bind("Keyboard", "Up");
m_controller->GetKey(KEY_MOVE_BACK).Bind("Keyboard", "Down");
m_controller->GetKey(KEY_MOVE_LEFT).Bind("Keyboard", "Left");
m_controller->GetKey(KEY_MOVE_RIGHT).Bind("Keyboard", "Right");
m_controller->GetKey(KEY_MOVE_JUMP).Bind("Keyboard", "Space");
m_controller->GetKey(KEY_MOVE_UP).Bind("Keyboard", "PageUp");
m_controller->GetKey(KEY_MOVE_DOWN).Bind("Keyboard", "PageDown");
m_controller->GetKey(KEY_QUIT).Bind("Keyboard", "Escape");

/* Create a camera that matches the settings of XNA BtPhysTest */
m_camera = new Camera();
m_camera->SetView(vec3(50.f, 50.f, 0.f),
vec3(0.f, 0.f, 0.f),
vec3(0, 1, 0));
m_camera->SetProjection(45.f, .1f, 1000.f, (float)Video::GetSize().x, (float)Video::GetSize().y / (float)Video::GetSize().x);
g_scene->PushCamera(m_camera);

m_ready = false;

/*
m_simulation = new Simulation();
m_simulation->SetWorldLimit(vec3(-1000.0f, -1000.0f, -1000.0f), vec3(1000.0f, 1000.0f, 1000.0f));
m_simulation->Init();
vec3 NewGravity = vec3(.0f, -10.0f, .0f);
m_simulation->SetGravity(NewGravity);
m_simulation->SetContinuousDetection(true);
m_simulation->SetTimestep(1.f / 120.f);
Ticker::Ref(m_simulation);
*/

/* Add a white directional light */
m_light1 = new Light();
m_light1->SetPosition(vec4(0.2f, 0.2f, 0.f, 0.f));
m_light1->SetColor(vec4(0.5f, 0.5f, 0.5f, 1.f));
Ticker::Ref(m_light1);

/* Add an orangeish point light */
m_light2 = new Light();
m_light2->SetPosition(vec4(-15.f, 15.f, 15.f, 1.f));
m_light2->SetColor(vec4(0.4f, 0.3f, 0.2f, 1.f));
Ticker::Ref(m_light2);
}

void Nacl_PhysTest::TickGame(float seconds)
{
WorldEntity::TickGame(seconds);

if (m_controller->GetKey(KEY_QUIT).IsReleased())
Ticker::Shutdown();
}

void Nacl_PhysTest::TickDraw(float seconds)
{
WorldEntity::TickDraw(seconds);

if (!m_ready)
{
/* FIXME: this object never cleans up */
m_ready = true;
}
else
{
}
}

Nacl_PhysTest::~Nacl_PhysTest()
{
g_scene->PopCamera(m_camera);
Ticker::Unref(m_light1);
Ticker::Unref(m_light2);

//Ticker::Unref(m_simulation);
}

int main(int argc, char **argv)
{
System::Init(argc, argv);

Application app("Nacl_PhysTest", ivec2(1280, 960), 60.0f);

new Nacl_PhysTest(argc > 1);
app.ShowPointer(false);

app.Run();

return EXIT_SUCCESS;
}


+ 61
- 0
test/nacl_phystest.h Datei anzeigen

@@ -0,0 +1,61 @@
//
// BtPhysTest
//
// Copyright: (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// (c) 2012 Sam Hocevar <sam@hocevar.net>
//

#if !defined __BTPHYSTEST_H__
#define __BTPHYSTEST_H__

class Nacl_PhysTest : public WorldEntity
{
public:
Nacl_PhysTest(bool editor = false);
virtual ~Nacl_PhysTest();

char const *GetName() { return "<Nacl_PhysTest>"; }

protected:
virtual void TickGame(float seconds);
virtual void TickDraw(float seconds);

private:
enum
{
KEY_MOVE_FORWARD,
KEY_MOVE_BACK,
KEY_MOVE_LEFT,
KEY_MOVE_RIGHT,
KEY_MOVE_UP,
KEY_MOVE_DOWN,
KEY_MOVE_JUMP,
KEY_QUIT,
KEY_MAX,
};

TileSet* m_cat_texture;
Shader* m_cat_shader;
Camera* m_camera;
Controller * m_controller;
Light * m_light1;
Light * m_light2;
bool m_ready;

//lol::phys::Simulation* m_simulation;
//Array<EasyConstraint*> m_constraint_list;
//Array<PhysicsObject*, float> m_physobj_list;
//Array<PhysicsObject*> m_ground_list;
//Array<PhysicsObject*> m_platform_list;
//Array<PhysicsObject*> m_character_list;
//Array<PhysicsObject*> m_stairs_list;

float m_loop_value;
float m_target_timer;
int m_cam_target;
float m_fov_dp;
float m_loc_dp;
};

#endif // __BTPHYSTEST_H__


+ 87
- 0
test/nacl_phystest.vcxproj Datei anzeigen

@@ -0,0 +1,87 @@
<?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|ORBIS">
<Configuration>Debug</Configuration>
<Platform>ORBIS</Platform>
</ProjectConfiguration>
<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|ORBIS">
<Configuration>Release</Configuration>
<Platform>ORBIS</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>
<ClInclude Include="nacl_phystest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="nacl_phystest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\..\..\src\lolcore.vcxproj">
<Project>{9e62f2fe-3408-4eae-8238-fd84238ceeda}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\..\src\bullet\lolbullet.vcxproj">
<Project>{83d3b207-c601-4025-8f41-01dedc354661}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\..\src\lua\lollua.vcxproj">
<Project>{d84021ca-b233-4e0f-8a52-071b83bbccc4}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</None>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{ee203b88-44cf-4859-9d42-7a1f43fecb53}</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>

+ 20
- 0
test/nacl_phystest.vcxproj.filters Datei anzeigen

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="nacl_phystest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="nacl_phystest.cpp" />
</ItemGroup>
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{4fc7662b-b17a-49b9-acd1-0cf767183b07}</UniqueIdentifier>
</Filter>
<Filter Include="physics">
<UniqueIdentifier>{ccecd634-9321-4c49-9471-e9da50dda6d4}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
</ItemGroup>
</Project>

Laden…
Abbrechen
Speichern