mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
fixed build for linux and ps2
This commit is contained in:
parent
d00ab2f526
commit
239a4eb4bc
17
premake5.lua
17
premake5.lua
@ -130,6 +130,7 @@ project "clumpview"
|
||||
skeltool("clumpview")
|
||||
flags { "WinMain" }
|
||||
removeplatforms { "*null" }
|
||||
removeplatforms { "ps2" } -- for now
|
||||
|
||||
project "ps2test"
|
||||
kind "ConsoleApp"
|
||||
@ -148,11 +149,11 @@ project "ps2test"
|
||||
-- "c -lc" is a hack because we need -lc twice for some reason
|
||||
links { "c -lc", "kernel", "mf" }
|
||||
|
||||
project "ps2rastertest"
|
||||
kind "ConsoleApp"
|
||||
targetdir (Bindir)
|
||||
removeplatforms { "*gl3", "*d3d9" }
|
||||
files { "tools/ps2rastertest/*.cpp" }
|
||||
includedirs { "." }
|
||||
libdirs { Libdir }
|
||||
links { "librw" }
|
||||
--project "ps2rastertest"
|
||||
-- kind "ConsoleApp"
|
||||
-- targetdir (Bindir)
|
||||
-- removeplatforms { "*gl3", "*d3d9" }
|
||||
-- files { "tools/ps2rastertest/*.cpp" }
|
||||
-- includedirs { "." }
|
||||
-- libdirs { Libdir }
|
||||
-- links { "librw" }
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include <Windows.h>
|
||||
#include <rw.h>
|
||||
#include "skeleton.h"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <Windows.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <rw.h>
|
||||
#include "skeleton.h"
|
||||
|
||||
@ -221,3 +222,4 @@ WinMain(HINSTANCE instance, HINSTANCE,
|
||||
return main(__argc, __argv);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -134,13 +134,13 @@ skinInstanceCB(Geometry *geo, InstanceDataHeader *header)
|
||||
|
||||
int32 w[4];
|
||||
int sum;
|
||||
float *weights = skin->weights;
|
||||
float32 *weights = skin->weights;
|
||||
uint8 *p = vbuf;
|
||||
int32 numVertices = header->numVertices;
|
||||
while(numVertices--){
|
||||
sum = 0;
|
||||
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];
|
||||
}
|
||||
w[0] = 255 - sum;
|
||||
|
@ -517,7 +517,7 @@ Geometry::buildMeshes(void)
|
||||
// count indices per mesh
|
||||
tri = this->triangles;
|
||||
for(int32 i = 0; i < this->numTriangles; i++){
|
||||
assert(tri->matId >= 0 && tri->matId < numMeshes);
|
||||
assert(tri->matId < numMeshes);
|
||||
numIndices[tri->matId] += 3;
|
||||
tri++;
|
||||
}
|
||||
|
@ -628,3 +628,4 @@ Device renderdevice = {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -240,3 +240,4 @@ void initMatFX(void) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,3 +115,4 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -305,3 +305,4 @@ void initSkin(void) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,9 @@ Device renderdevice = {
|
||||
null::setRenderState,
|
||||
null::getRenderState,
|
||||
null::im2DRenderIndexedPrimitive,
|
||||
null::im3DTransform,
|
||||
null::im3DRenderIndexed,
|
||||
null::im3DEnd,
|
||||
null::deviceSystem
|
||||
};
|
||||
|
||||
|
@ -49,3 +49,4 @@ End(void)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -269,6 +269,8 @@ struct Texture
|
||||
|
||||
static Texture *(*findCB)(const char *name);
|
||||
static Texture *(*readCB)(const char *name, const char *mask);
|
||||
static void setLoadTextures(bool32);
|
||||
static void setCreateDummies(bool32);
|
||||
|
||||
#ifndef RWPUBLIC
|
||||
static void registerModule(void);
|
||||
|
@ -69,3 +69,4 @@ void End(void);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,18 @@ Texture::registerModule(void)
|
||||
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
|
||||
//
|
||||
|
@ -284,33 +284,33 @@ remove(UserDataExtension *ext, int32 n)
|
||||
|
||||
#define ACCESSOR(TYPE, NAME) \
|
||||
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); \
|
||||
} \
|
||||
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 \
|
||||
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::##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 &PLUGINOFFSET(UserDataExtension, t, userDataGlobals.##NAME##Offset)->arrays[n]; \
|
||||
return &PLUGINOFFSET(UserDataExtension, t, userDataGlobals.NAME##Offset)->arrays[n]; \
|
||||
} \
|
||||
int32 \
|
||||
UserDataArray::##NAME##FindIndex(TYPE *t, const char *name) \
|
||||
UserDataArray::NAME##FindIndex(TYPE *t, const char *name) \
|
||||
{ \
|
||||
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++) \
|
||||
if(strcmp(ext->arrays[i].name, name) == 0) \
|
||||
return i; \
|
||||
|
@ -167,7 +167,7 @@ InitRW(void)
|
||||
|
||||
tex = rw::Texture::read("maze", nil);
|
||||
|
||||
char *filename = "teapot.dff";
|
||||
const char *filename = "teapot.dff";
|
||||
if(sk::args.argc > 1)
|
||||
filename = sk::args.argv[1];
|
||||
rw::StreamFile in;
|
||||
|
@ -658,7 +658,7 @@ initrw(void)
|
||||
return 0;
|
||||
if(!rw::Engine::start(&engineStartParams))
|
||||
return 0;
|
||||
rw::engine->loadTextures = 0;
|
||||
rw::Texture::setLoadTextures(0);
|
||||
|
||||
rw::TexDictionary::setCurrent(rw::TexDictionary::create());
|
||||
rw::Image::setSearchPath(".");
|
||||
|
Loading…
Reference in New Issue
Block a user