From fca3327ae218ac56dbec4d7d85d215ac4c5ff551 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 27 Aug 2015 16:45:54 +0200 Subject: [PATCH] restructured some files --- Makefile | 5 +- TODO | 1 - build/win32_2013/librw_2013.sln | 28 ------- build/win32_2013/librw_2013.vcxproj | 101 ------------------------- dffwrite.cpp => tools/dffwrite.cpp | 4 +- dumprwtree.cpp => tools/dumprwtree.cpp | 2 +- {tests => tools}/gl/Makefile | 7 +- {tests => tools}/gl/Makefile.mingw | 0 {tests => tools}/gl/camera.cpp | 0 {tests => tools}/gl/camera.h | 0 {tests => tools}/gl/gl.h | 0 {tests => tools}/gl/glshader.cpp | 0 {tests => tools}/gl/main.cpp | 10 ++- {tests => tools}/gl/math.cpp | 0 {tests => tools}/gl/math/conversion.h | 0 {tests => tools}/gl/math/dquat.h | 0 {tests => tools}/gl/math/mat3.h | 0 {tests => tools}/gl/math/mat4.h | 0 {tests => tools}/gl/math/math.h | 0 {tests => tools}/gl/math/quat.h | 0 {tests => tools}/gl/math/vec3.h | 0 {tests => tools}/gl/math/vec4.h | 0 {tests => tools}/gl/rwtest.h | 0 insttest.cpp => tools/insttest.cpp | 4 +- {tests => tools}/ps2/Makefile | 0 {tests => tools}/ps2/README.md | 2 +- {tests => tools}/ps2/defaultpipe.dsm | 0 {tests => tools}/ps2/dma.cpp | 0 {tests => tools}/ps2/dma.h | 0 {tests => tools}/ps2/ee_regs.h | 0 {tests => tools}/ps2/gif.h | 0 {tests => tools}/ps2/gs.cpp | 0 {tests => tools}/ps2/gs.h | 0 {tests => tools}/ps2/light.vu | 0 {tests => tools}/ps2/main.cpp | 0 {tests => tools}/ps2/math.cpp | 0 {tests => tools}/ps2/math.h | 0 {tests => tools}/ps2/mesh.cpp | 0 {tests => tools}/ps2/mesh.h | 0 {tests => tools}/ps2/mips_regs.h | 0 {tests => tools}/ps2/ps2.h | 0 {tests => tools}/ps2/skinpipe.dsm | 0 {tests => tools}/ps2/vu.dsm | 0 various/dffwrite/dffwrite_2013.vcxproj | 96 ----------------------- 44 files changed, 22 insertions(+), 238 deletions(-) delete mode 100644 build/win32_2013/librw_2013.sln delete mode 100644 build/win32_2013/librw_2013.vcxproj rename dffwrite.cpp => tools/dffwrite.cpp (97%) rename dumprwtree.cpp => tools/dumprwtree.cpp (99%) rename {tests => tools}/gl/Makefile (79%) rename {tests => tools}/gl/Makefile.mingw (100%) rename {tests => tools}/gl/camera.cpp (100%) rename {tests => tools}/gl/camera.h (100%) rename {tests => tools}/gl/gl.h (100%) rename {tests => tools}/gl/glshader.cpp (100%) rename {tests => tools}/gl/main.cpp (96%) rename {tests => tools}/gl/math.cpp (100%) rename {tests => tools}/gl/math/conversion.h (100%) rename {tests => tools}/gl/math/dquat.h (100%) rename {tests => tools}/gl/math/mat3.h (100%) rename {tests => tools}/gl/math/mat4.h (100%) rename {tests => tools}/gl/math/math.h (100%) rename {tests => tools}/gl/math/quat.h (100%) rename {tests => tools}/gl/math/vec3.h (100%) rename {tests => tools}/gl/math/vec4.h (100%) rename {tests => tools}/gl/rwtest.h (100%) rename insttest.cpp => tools/insttest.cpp (97%) mode change 100644 => 100755 rename {tests => tools}/ps2/Makefile (100%) rename {tests => tools}/ps2/README.md (87%) rename {tests => tools}/ps2/defaultpipe.dsm (100%) rename {tests => tools}/ps2/dma.cpp (100%) rename {tests => tools}/ps2/dma.h (100%) rename {tests => tools}/ps2/ee_regs.h (100%) rename {tests => tools}/ps2/gif.h (100%) rename {tests => tools}/ps2/gs.cpp (100%) rename {tests => tools}/ps2/gs.h (100%) rename {tests => tools}/ps2/light.vu (100%) rename {tests => tools}/ps2/main.cpp (100%) rename {tests => tools}/ps2/math.cpp (100%) rename {tests => tools}/ps2/math.h (100%) rename {tests => tools}/ps2/mesh.cpp (100%) rename {tests => tools}/ps2/mesh.h (100%) rename {tests => tools}/ps2/mips_regs.h (100%) rename {tests => tools}/ps2/ps2.h (100%) rename {tests => tools}/ps2/skinpipe.dsm (100%) rename {tests => tools}/ps2/vu.dsm (100%) delete mode 100644 various/dffwrite/dffwrite_2013.vcxproj diff --git a/Makefile b/Makefile index 557535b..59cbcb9 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ SRC := $(patsubst %.cpp,$(SRCDIR)/%.cpp, rwbase.cpp clump.cpp\ image.cpp gtaplg.cpp) OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRC)) DEP := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.d,$(SRC)) +INC := -I/usr/local/include CFLAGS=-Wall -Wextra -g $(BUILDDEF) -Wno-parentheses #-Wconversion LIB=librw-$(BUILD).a @@ -19,11 +20,11 @@ $(LIB): $(OBJ) $(BUILDDIR)/%.o: $(SRCDIR)/%.cpp @mkdir -p $(@D) - $(CXX) $(CFLAGS) -c $< -o $@ + $(CXX) $(CFLAGS) $(INC) -c $< -o $@ $(BUILDDIR)/%.d: $(SRCDIR)/%.cpp @mkdir -p $(@D) - $(CXX) -MM -MT '$(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$<)' $(CFLAGS) $< > $@ + $(CXX) -MM -MT '$(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$<)' $(CFLAGS) $(INC) $< > $@ clean: rm -f $(BUILDDIR)/*.[od] diff --git a/TODO b/TODO index 226e89e..35f30b3 100644 --- a/TODO +++ b/TODO @@ -25,7 +25,6 @@ Clump & related: Geometry ((Morph)) 0x105 R* 2dfx 0x253F2F8 - R* mystery xbox plugin 0x253F2F2 Material UV Anim 0x135 Texture diff --git a/build/win32_2013/librw_2013.sln b/build/win32_2013/librw_2013.sln deleted file mode 100644 index 7c2573e..0000000 --- a/build/win32_2013/librw_2013.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librw_2013", "librw_2013.vcxproj", "{44700D30-55D1-4D17-917C-5BF474F322C4}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dffwrite", "..\..\various\dffwrite\dffwrite_2013.vcxproj", "{FD03F2BD-125B-4D3C-809D-420D8DABEB5B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {44700D30-55D1-4D17-917C-5BF474F322C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {44700D30-55D1-4D17-917C-5BF474F322C4}.Debug|Win32.Build.0 = Debug|Win32 - {44700D30-55D1-4D17-917C-5BF474F322C4}.Release|Win32.ActiveCfg = Release|Win32 - {44700D30-55D1-4D17-917C-5BF474F322C4}.Release|Win32.Build.0 = Release|Win32 - {FD03F2BD-125B-4D3C-809D-420D8DABEB5B}.Debug|Win32.ActiveCfg = Debug|Win32 - {FD03F2BD-125B-4D3C-809D-420D8DABEB5B}.Debug|Win32.Build.0 = Debug|Win32 - {FD03F2BD-125B-4D3C-809D-420D8DABEB5B}.Release|Win32.ActiveCfg = Release|Win32 - {FD03F2BD-125B-4D3C-809D-420D8DABEB5B}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/build/win32_2013/librw_2013.vcxproj b/build/win32_2013/librw_2013.vcxproj deleted file mode 100644 index 47965f2..0000000 --- a/build/win32_2013/librw_2013.vcxproj +++ /dev/null @@ -1,101 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {44700D30-55D1-4D17-917C-5BF474F322C4} - win32_2013 - - - - StaticLibrary - true - v120 - MultiByte - - - StaticLibrary - false - v120 - true - MultiByte - - - - - - - - - - - - - librw_d_2013 - $(ProjectDir)..\..\lib\ - $(ProjectDir)..\..\obj\win32_$(Configuration)_2013\ - - - librw_2013 - $(ProjectDir)..\..\lib\ - $(ProjectDir)..\..\obj\win32_$(Configuration)_2013\ - - - - Level3 - Disabled - true - 4996 - MultiThreadedDebug - - - true - - - - - Level3 - MaxSpeed - true - true - true - 4996 - MultiThreaded - - - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dffwrite.cpp b/tools/dffwrite.cpp similarity index 97% rename from dffwrite.cpp rename to tools/dffwrite.cpp index cd13785..2c45bd9 100644 --- a/dffwrite.cpp +++ b/tools/dffwrite.cpp @@ -4,8 +4,8 @@ #include #include -#include "rw.h" -#include "src/gtaplg.h" +#include "../rw.h" +#include "../src/gtaplg.h" using namespace std; diff --git a/dumprwtree.cpp b/tools/dumprwtree.cpp similarity index 99% rename from dumprwtree.cpp rename to tools/dumprwtree.cpp index 7410073..04e58ec 100644 --- a/dumprwtree.cpp +++ b/tools/dumprwtree.cpp @@ -4,7 +4,7 @@ #include #include -#include "rw.h" +#include "../rw.h" using namespace std; using namespace rw; diff --git a/tests/gl/Makefile b/tools/gl/Makefile similarity index 79% rename from tests/gl/Makefile rename to tools/gl/Makefile index 7569e38..4984446 100755 --- a/tests/gl/Makefile +++ b/tools/gl/Makefile @@ -4,7 +4,8 @@ OBJ = $(patsubst %.cpp, $(BUILDDIR)/%.o, $(SRC)) DEP = $(patsubst %.cpp, $(BUILDDIR)/%.d, $(SRC)) RWDIR=$(HOME)/src/librw -LDLIBS=-pthread -lX11 -lXrandr -lXi -lXxf86vm -lGL -lGLEW -lm +INC := -I/usr/local/include +LDLIBS=-L/usr/local/lib -pthread -lX11 -lXrandr -lXi -lXxf86vm -lGL -lGLEW -lm STATICLIBS= $(RWDIR)/librw-opengl.a /usr/local/lib/libglfw3.a #LDLIBS=-pthread -lGL -lGLEW -lglfw @@ -17,11 +18,11 @@ rwtest: $(OBJ) $(STATICLIBS) $(BUILDDIR)/%.o: %.cpp @mkdir -p $(@D) - $(CXX) $(CFLAGS) -c $< -o $@ + $(CXX) $(CFLAGS) $(INC) -c $< -o $@ $(BUILDDIR)/%.d: %.cpp @mkdir -p $(@D) - $(CXX) -MM -MT '$(patsubst %.cpp,$(BUILDDIR)%.o,$<)' $(CFLAGS) $< > $@ + $(CXX) -MM -MT '$(patsubst %.cpp,$(BUILDDIR)%.o,$<)' $(CFLAGS) $(INC) $< > $@ clean: rm $(BUILDDIR)/* rwtest diff --git a/tests/gl/Makefile.mingw b/tools/gl/Makefile.mingw similarity index 100% rename from tests/gl/Makefile.mingw rename to tools/gl/Makefile.mingw diff --git a/tests/gl/camera.cpp b/tools/gl/camera.cpp similarity index 100% rename from tests/gl/camera.cpp rename to tools/gl/camera.cpp diff --git a/tests/gl/camera.h b/tools/gl/camera.h similarity index 100% rename from tests/gl/camera.h rename to tools/gl/camera.h diff --git a/tests/gl/gl.h b/tools/gl/gl.h similarity index 100% rename from tests/gl/gl.h rename to tools/gl/gl.h diff --git a/tests/gl/glshader.cpp b/tools/gl/glshader.cpp similarity index 100% rename from tests/gl/glshader.cpp rename to tools/gl/glshader.cpp diff --git a/tests/gl/main.cpp b/tools/gl/main.cpp similarity index 96% rename from tests/gl/main.cpp rename to tools/gl/main.cpp index 10615ef..0203dda 100755 --- a/tests/gl/main.cpp +++ b/tools/gl/main.cpp @@ -127,8 +127,15 @@ init(void) "void main()" "{" " gl_Position = projMat * viewMat * worldMat * vec4(in_vertex, 1.0);" + + " vec3 N = normalize(mat3(viewMat * worldMat) * in_normal);" + " vec3 P = vec3(viewMat * worldMat * vec4(in_vertex, 1.0));" + " vec3 V = normalize(-P);" + " float rim = 1.0 - max(dot(V, N), 0.0);" + " vec3 n = mat3(worldMat) * in_normal;" " float l = max(0.0, dot(n, -lightdir));" +// " l = l*0.4 + rim;" " v_color = (in_color+vec4(l,l,l,0)+amblight)*matColor;" " v_texCoord = in_texCoord;" "}\n" @@ -179,7 +186,8 @@ init(void) camera->setAspectRatio(1.0f*screenWidth/screenHeight); camera->setNearFar(0.1f, 450.0f); camera->setTarget(Vec3(0.0f, 0.0f, 0.0f)); - camera->setPosition(Vec3(0.0f, 5.0f, 0.0f)); +// camera->setPosition(Vec3(0.0f, 5.0f, 0.0f)); + camera->setPosition(Vec3(0.0f, -1.0f, 3.0f)); rw::currentTexDictionary = new rw::TexDictionary; // rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/"); diff --git a/tests/gl/math.cpp b/tools/gl/math.cpp similarity index 100% rename from tests/gl/math.cpp rename to tools/gl/math.cpp diff --git a/tests/gl/math/conversion.h b/tools/gl/math/conversion.h similarity index 100% rename from tests/gl/math/conversion.h rename to tools/gl/math/conversion.h diff --git a/tests/gl/math/dquat.h b/tools/gl/math/dquat.h similarity index 100% rename from tests/gl/math/dquat.h rename to tools/gl/math/dquat.h diff --git a/tests/gl/math/mat3.h b/tools/gl/math/mat3.h similarity index 100% rename from tests/gl/math/mat3.h rename to tools/gl/math/mat3.h diff --git a/tests/gl/math/mat4.h b/tools/gl/math/mat4.h similarity index 100% rename from tests/gl/math/mat4.h rename to tools/gl/math/mat4.h diff --git a/tests/gl/math/math.h b/tools/gl/math/math.h similarity index 100% rename from tests/gl/math/math.h rename to tools/gl/math/math.h diff --git a/tests/gl/math/quat.h b/tools/gl/math/quat.h similarity index 100% rename from tests/gl/math/quat.h rename to tools/gl/math/quat.h diff --git a/tests/gl/math/vec3.h b/tools/gl/math/vec3.h similarity index 100% rename from tests/gl/math/vec3.h rename to tools/gl/math/vec3.h diff --git a/tests/gl/math/vec4.h b/tools/gl/math/vec4.h similarity index 100% rename from tests/gl/math/vec4.h rename to tools/gl/math/vec4.h diff --git a/tests/gl/rwtest.h b/tools/gl/rwtest.h similarity index 100% rename from tests/gl/rwtest.h rename to tools/gl/rwtest.h diff --git a/insttest.cpp b/tools/insttest.cpp old mode 100644 new mode 100755 similarity index 97% rename from insttest.cpp rename to tools/insttest.cpp index 14630a7..f922b33 --- a/insttest.cpp +++ b/tools/insttest.cpp @@ -4,8 +4,8 @@ #include #include -#include "rw.h" -#include "src/gtaplg.h" +#include "../rw.h" +#include "../src/gtaplg.h" using namespace std; using namespace rw; diff --git a/tests/ps2/Makefile b/tools/ps2/Makefile similarity index 100% rename from tests/ps2/Makefile rename to tools/ps2/Makefile diff --git a/tests/ps2/README.md b/tools/ps2/README.md similarity index 87% rename from tests/ps2/README.md rename to tools/ps2/README.md index f587b32..dfe917e 100644 --- a/tests/ps2/README.md +++ b/tools/ps2/README.md @@ -8,7 +8,7 @@ To compile you need the ps2toolchain and ee-dvp-as from the Sony SDK (dvp-as from the ps2toolchain segfaults when encountering MPG, this should be fixed). -So far the program can render PS2 native geometry (no generic geometry atm) +So far the program can render PS2 native geometry in the default or skin format (no PDS pipes as used in San Andreas supported yet). The files are read from host: (see main.cpp) so you can use e.g. ps2link on a real PS2 or pcsx2 with the host device enabled. diff --git a/tests/ps2/defaultpipe.dsm b/tools/ps2/defaultpipe.dsm similarity index 100% rename from tests/ps2/defaultpipe.dsm rename to tools/ps2/defaultpipe.dsm diff --git a/tests/ps2/dma.cpp b/tools/ps2/dma.cpp similarity index 100% rename from tests/ps2/dma.cpp rename to tools/ps2/dma.cpp diff --git a/tests/ps2/dma.h b/tools/ps2/dma.h similarity index 100% rename from tests/ps2/dma.h rename to tools/ps2/dma.h diff --git a/tests/ps2/ee_regs.h b/tools/ps2/ee_regs.h similarity index 100% rename from tests/ps2/ee_regs.h rename to tools/ps2/ee_regs.h diff --git a/tests/ps2/gif.h b/tools/ps2/gif.h similarity index 100% rename from tests/ps2/gif.h rename to tools/ps2/gif.h diff --git a/tests/ps2/gs.cpp b/tools/ps2/gs.cpp similarity index 100% rename from tests/ps2/gs.cpp rename to tools/ps2/gs.cpp diff --git a/tests/ps2/gs.h b/tools/ps2/gs.h similarity index 100% rename from tests/ps2/gs.h rename to tools/ps2/gs.h diff --git a/tests/ps2/light.vu b/tools/ps2/light.vu similarity index 100% rename from tests/ps2/light.vu rename to tools/ps2/light.vu diff --git a/tests/ps2/main.cpp b/tools/ps2/main.cpp similarity index 100% rename from tests/ps2/main.cpp rename to tools/ps2/main.cpp diff --git a/tests/ps2/math.cpp b/tools/ps2/math.cpp similarity index 100% rename from tests/ps2/math.cpp rename to tools/ps2/math.cpp diff --git a/tests/ps2/math.h b/tools/ps2/math.h similarity index 100% rename from tests/ps2/math.h rename to tools/ps2/math.h diff --git a/tests/ps2/mesh.cpp b/tools/ps2/mesh.cpp similarity index 100% rename from tests/ps2/mesh.cpp rename to tools/ps2/mesh.cpp diff --git a/tests/ps2/mesh.h b/tools/ps2/mesh.h similarity index 100% rename from tests/ps2/mesh.h rename to tools/ps2/mesh.h diff --git a/tests/ps2/mips_regs.h b/tools/ps2/mips_regs.h similarity index 100% rename from tests/ps2/mips_regs.h rename to tools/ps2/mips_regs.h diff --git a/tests/ps2/ps2.h b/tools/ps2/ps2.h similarity index 100% rename from tests/ps2/ps2.h rename to tools/ps2/ps2.h diff --git a/tests/ps2/skinpipe.dsm b/tools/ps2/skinpipe.dsm similarity index 100% rename from tests/ps2/skinpipe.dsm rename to tools/ps2/skinpipe.dsm diff --git a/tests/ps2/vu.dsm b/tools/ps2/vu.dsm similarity index 100% rename from tests/ps2/vu.dsm rename to tools/ps2/vu.dsm diff --git a/various/dffwrite/dffwrite_2013.vcxproj b/various/dffwrite/dffwrite_2013.vcxproj deleted file mode 100644 index b298cb3..0000000 --- a/various/dffwrite/dffwrite_2013.vcxproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {FD03F2BD-125B-4D3C-809D-420D8DABEB5B} - dffwrite - - - - Application - true - v120 - MultiByte - - - Application - false - v120 - true - MultiByte - - - - - - - - - - - - - $(ProjectDir)..\..\bin\ - $(ProjectDir)..\..\obj\dffwrite\win32_$(Configuration)_2013\ - dffwrite_d - - - $(ProjectDir)..\..\bin\ - $(ProjectDir)..\..\obj\dffwrite\win32_$(Configuration)_2013\ - dffwrite - - - - Level3 - Disabled - true - 4996 - MultiThreadedDebug - - - true - $(OutDir)$(TargetName)_2013.pdb - $(IntDir)$(TargetName)_2013$(TargetExt).intermediate.manifest - ..\..\lib\ - librw_d_2013.lib;%(AdditionalDependencies) - - - - - Level3 - MaxSpeed - true - true - true - 4996 - MultiThreaded - - - true - true - true - $(OutDir)$(TargetName)_2013.pdb - $(IntDir)$(TargetName)_2013$(TargetExt).intermediate.manifest - ..\..\lib\ - librw_2013.lib;%(AdditionalDependencies) - - - - - - - - - - - - \ No newline at end of file