fixed build for linux and ps2

This commit is contained in:
aap 2017-08-29 14:05:45 +02:00
parent d00ab2f526
commit 239a4eb4bc
17 changed files with 53 additions and 28 deletions

View File

@ -130,6 +130,7 @@ project "clumpview"
skeltool("clumpview") skeltool("clumpview")
flags { "WinMain" } flags { "WinMain" }
removeplatforms { "*null" } removeplatforms { "*null" }
removeplatforms { "ps2" } -- for now
project "ps2test" project "ps2test"
kind "ConsoleApp" kind "ConsoleApp"
@ -148,11 +149,11 @@ project "ps2test"
-- "c -lc" is a hack because we need -lc twice for some reason -- "c -lc" is a hack because we need -lc twice for some reason
links { "c -lc", "kernel", "mf" } links { "c -lc", "kernel", "mf" }
project "ps2rastertest" --project "ps2rastertest"
kind "ConsoleApp" -- kind "ConsoleApp"
targetdir (Bindir) -- targetdir (Bindir)
removeplatforms { "*gl3", "*d3d9" } -- removeplatforms { "*gl3", "*d3d9" }
files { "tools/ps2rastertest/*.cpp" } -- files { "tools/ps2rastertest/*.cpp" }
includedirs { "." } -- includedirs { "." }
libdirs { Libdir } -- libdirs { Libdir }
links { "librw" } -- links { "librw" }

View File

@ -1,4 +1,3 @@
#include <Windows.h>
#include <rw.h> #include <rw.h>
#include "skeleton.h" #include "skeleton.h"

View File

@ -1,4 +1,5 @@
#include <Windows.h> #ifdef _WIN32
#include <windows.h>
#include <rw.h> #include <rw.h>
#include "skeleton.h" #include "skeleton.h"
@ -221,3 +222,4 @@ WinMain(HINSTANCE instance, HINSTANCE,
return main(__argc, __argv); return main(__argc, __argv);
} }
#endif #endif
#endif

View File

@ -134,13 +134,13 @@ skinInstanceCB(Geometry *geo, InstanceDataHeader *header)
int32 w[4]; int32 w[4];
int sum; int sum;
float *weights = skin->weights; float32 *weights = skin->weights;
uint8 *p = vbuf; uint8 *p = vbuf;
int32 numVertices = header->numVertices; int32 numVertices = header->numVertices;
while(numVertices--){ while(numVertices--){
sum = 0; sum = 0;
for(int i = 1; i < skin->numWeights; i++){ for(int i = 1; i < skin->numWeights; i++){
w[i] = weights[i]*255.0f + 0.5f; w[i] = (int32)(weights[i]*255.0f + 0.5f);
sum += w[i]; sum += w[i];
} }
w[0] = 255 - sum; w[0] = 255 - sum;

View File

@ -517,7 +517,7 @@ Geometry::buildMeshes(void)
// count indices per mesh // count indices per mesh
tri = this->triangles; tri = this->triangles;
for(int32 i = 0; i < this->numTriangles; i++){ for(int32 i = 0; i < this->numTriangles; i++){
assert(tri->matId >= 0 && tri->matId < numMeshes); assert(tri->matId < numMeshes);
numIndices[tri->matId] += 3; numIndices[tri->matId] += 3;
tri++; tri++;
} }

View File

@ -628,3 +628,4 @@ Device renderdevice = {
} }
#endif #endif

View File

@ -240,3 +240,4 @@ void initMatFX(void) { }
} }
} }

View File

@ -115,3 +115,4 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
} }
#endif #endif

View File

@ -305,3 +305,4 @@ void initSkin(void) { }
} }
} }

View File

@ -32,6 +32,9 @@ Device renderdevice = {
null::setRenderState, null::setRenderState,
null::getRenderState, null::getRenderState,
null::im2DRenderIndexedPrimitive, null::im2DRenderIndexedPrimitive,
null::im3DTransform,
null::im3DRenderIndexed,
null::im3DEnd,
null::deviceSystem null::deviceSystem
}; };

View File

@ -49,3 +49,4 @@ End(void)
} }
} }

View File

@ -269,6 +269,8 @@ struct Texture
static Texture *(*findCB)(const char *name); static Texture *(*findCB)(const char *name);
static Texture *(*readCB)(const char *name, const char *mask); static Texture *(*readCB)(const char *name, const char *mask);
static void setLoadTextures(bool32);
static void setCreateDummies(bool32);
#ifndef RWPUBLIC #ifndef RWPUBLIC
static void registerModule(void); static void registerModule(void);

View File

@ -69,3 +69,4 @@ void End(void);
} }
} }

View File

@ -63,6 +63,18 @@ Texture::registerModule(void)
Engine::registerPlugin(sizeof(TextureGlobals), ID_TEXTUREMODULE, textureOpen, textureClose); Engine::registerPlugin(sizeof(TextureGlobals), ID_TEXTUREMODULE, textureOpen, textureClose);
} }
void
Texture::setLoadTextures(bool32 b)
{
TEXTUREGLOBAL(loadTextures) = b;
}
void
Texture::setCreateDummies(bool32 b)
{
TEXTUREGLOBAL(makeDummies) = b;
}
// //
// TexDictionary // TexDictionary
// //

View File

@ -284,33 +284,33 @@ remove(UserDataExtension *ext, int32 n)
#define ACCESSOR(TYPE, NAME) \ #define ACCESSOR(TYPE, NAME) \
int32 \ int32 \
UserDataArray::##NAME##Add(TYPE *t, const char *name, int32 datatype, int32 numElements) \ UserDataArray::NAME##Add(TYPE *t, const char *name, int32 datatype, int32 numElements) \
{ \ { \
return add(PLUGINOFFSET(UserDataExtension, t, userDataGlobals.##NAME##Offset), \ return add(PLUGINOFFSET(UserDataExtension, t, userDataGlobals.NAME##Offset), \
name, datatype, numElements); \ name, datatype, numElements); \
} \ } \
void \ void \
UserDataArray::##NAME##Remove(TYPE *t, int32 n) \ UserDataArray::NAME##Remove(TYPE *t, int32 n) \
{ \ { \
remove(PLUGINOFFSET(UserDataExtension, t, userDataGlobals.##NAME##Offset), n); \ remove(PLUGINOFFSET(UserDataExtension, t, userDataGlobals.NAME##Offset), n); \
} \ } \
int32 \ int32 \
UserDataArray::##NAME##GetCount(TYPE *t) \ UserDataArray::NAME##GetCount(TYPE *t) \
{ \ { \
return PLUGINOFFSET(UserDataExtension, t, userDataGlobals.##NAME##Offset)->numArrays; \ return PLUGINOFFSET(UserDataExtension, t, userDataGlobals.NAME##Offset)->numArrays; \
} \ } \
UserDataArray* \ UserDataArray* \
UserDataArray::##NAME##Get(TYPE *t, int32 n) \ UserDataArray::NAME##Get(TYPE *t, int32 n) \
{ \ { \
if(n >= PLUGINOFFSET(UserDataExtension, t, userDataGlobals.##NAME##Offset)->numArrays) \ if(n >= PLUGINOFFSET(UserDataExtension, t, userDataGlobals.NAME##Offset)->numArrays) \
return nil; \ return nil; \
return &PLUGINOFFSET(UserDataExtension, t, userDataGlobals.##NAME##Offset)->arrays[n]; \ return &PLUGINOFFSET(UserDataExtension, t, userDataGlobals.NAME##Offset)->arrays[n]; \
} \ } \
int32 \ int32 \
UserDataArray::##NAME##FindIndex(TYPE *t, const char *name) \ UserDataArray::NAME##FindIndex(TYPE *t, const char *name) \
{ \ { \
int32 i; \ int32 i; \
UserDataExtension *ext = PLUGINOFFSET(UserDataExtension, t, userDataGlobals.##NAME##Offset); \ UserDataExtension *ext = PLUGINOFFSET(UserDataExtension, t, userDataGlobals.NAME##Offset); \
for(i = 0; i < ext->numArrays; i++) \ for(i = 0; i < ext->numArrays; i++) \
if(strcmp(ext->arrays[i].name, name) == 0) \ if(strcmp(ext->arrays[i].name, name) == 0) \
return i; \ return i; \

View File

@ -167,7 +167,7 @@ InitRW(void)
tex = rw::Texture::read("maze", nil); tex = rw::Texture::read("maze", nil);
char *filename = "teapot.dff"; const char *filename = "teapot.dff";
if(sk::args.argc > 1) if(sk::args.argc > 1)
filename = sk::args.argv[1]; filename = sk::args.argv[1];
rw::StreamFile in; rw::StreamFile in;

View File

@ -658,7 +658,7 @@ initrw(void)
return 0; return 0;
if(!rw::Engine::start(&engineStartParams)) if(!rw::Engine::start(&engineStartParams))
return 0; return 0;
rw::engine->loadTextures = 0; rw::Texture::setLoadTextures(0);
rw::TexDictionary::setCurrent(rw::TexDictionary::create()); rw::TexDictionary::setCurrent(rw::TexDictionary::create());
rw::Image::setSearchPath("."); rw::Image::setSearchPath(".");