mirror of https://github.com/aap/librw.git
some renaming, frame synching, camera update
This commit is contained in:
parent
634a96be07
commit
3271713d16
|
@ -6,11 +6,31 @@
|
|||
#include "rwplg.h"
|
||||
#include "rwpipeline.h"
|
||||
#include "rwobjects.h"
|
||||
#include "rwengine.h"
|
||||
|
||||
#define PLUGIN_ID 0
|
||||
|
||||
namespace rw {
|
||||
|
||||
void
|
||||
defaultBeginUpdateCB(Camera *cam)
|
||||
{
|
||||
engine.currentCamera = cam;
|
||||
Frame::syncDirty();
|
||||
DRIVER.beginUpdate(cam);
|
||||
}
|
||||
|
||||
void
|
||||
defaultEndUpdateCB(Camera *cam)
|
||||
{
|
||||
DRIVER.endUpdate(cam);
|
||||
}
|
||||
|
||||
static void
|
||||
cameraSync(ObjectWithFrame*)
|
||||
{
|
||||
}
|
||||
|
||||
Camera*
|
||||
Camera::create(void)
|
||||
{
|
||||
|
@ -20,6 +40,7 @@ Camera::create(void)
|
|||
return nil;
|
||||
}
|
||||
cam->object.object.init(Camera::ID, 0);
|
||||
cam->object.syncCB = cameraSync;
|
||||
cam->viewWindow.set(1.0f, 1.0f);
|
||||
cam->viewOffset.set(0.0f, 0.0f);
|
||||
cam->nearPlane = 0.05f;
|
||||
|
@ -28,6 +49,10 @@ Camera::create(void)
|
|||
cam->projection = Camera::PERSPECTIVE;
|
||||
cam->clump = nil;
|
||||
cam->inClump.init();
|
||||
|
||||
cam->beginUpdateCB = defaultBeginUpdateCB;
|
||||
cam->endUpdateCB = defaultEndUpdateCB;
|
||||
|
||||
cam->constructPlugins();
|
||||
return cam;
|
||||
}
|
||||
|
@ -153,6 +178,29 @@ Camera::updateProjectionMatrix(void)
|
|||
this->projMat[14] = -this->nearPlane*this->projMat[10];
|
||||
this->projMat[15] = 1.0f;
|
||||
}
|
||||
}else if(rw::platform == PLATFORM_WDGL || rw::platform == PLATFORM_GL3){
|
||||
this->projMat[0] = invwx;
|
||||
this->projMat[1] = 0.0f;
|
||||
this->projMat[2] = 0.0f;
|
||||
this->projMat[3] = 0.0f;
|
||||
|
||||
this->projMat[4] = 0.0f;
|
||||
this->projMat[5] = invwy;
|
||||
this->projMat[6] = 0.0f;
|
||||
this->projMat[7] = 0.0f;
|
||||
|
||||
if(this->projection == PERSPECTIVE){
|
||||
this->projMat[8] = this->viewOffset.x*invwx;
|
||||
this->projMat[9] = this->viewOffset.y*invwy;
|
||||
this->projMat[10] = (this->farPlane+this->nearPlane)*invz;
|
||||
this->projMat[11] = 1.0f;
|
||||
|
||||
this->projMat[12] = 0.0f;
|
||||
this->projMat[13] = 0.0f;
|
||||
this->projMat[14] = -2.0f*this->nearPlane*this->farPlane*invz;
|
||||
this->projMat[15] = 0.0f;
|
||||
}else{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -315,6 +315,11 @@ Clump::render(void)
|
|||
// Atomic
|
||||
//
|
||||
|
||||
static void
|
||||
atomicSync(ObjectWithFrame*)
|
||||
{
|
||||
}
|
||||
|
||||
Atomic*
|
||||
Atomic::create(void)
|
||||
{
|
||||
|
@ -324,6 +329,7 @@ Atomic::create(void)
|
|||
return nil;
|
||||
}
|
||||
atomic->object.object.init(Atomic::ID, 0);
|
||||
atomic->object.syncCB = atomicSync;
|
||||
atomic->geometry = nil;
|
||||
atomic->worldBoundingSphere.center.set(0.0f, 0.0f, 0.0f);
|
||||
atomic->worldBoundingSphere.radius = 0.0f;
|
||||
|
@ -491,7 +497,7 @@ Atomic::getPipeline(void)
|
|||
{
|
||||
return this->pipeline ?
|
||||
this->pipeline :
|
||||
engine[platform].defaultPipeline;
|
||||
driver[platform].defaultPipeline;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
52
src/d3d.cpp
52
src/d3d.cpp
|
@ -10,15 +10,13 @@
|
|||
#include "rwengine.h"
|
||||
#include "rwd3d.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace rw {
|
||||
namespace d3d {
|
||||
|
||||
bool32 isP8supported = 1;
|
||||
|
||||
#ifdef RW_D3D9
|
||||
IDirect3DDevice9 *device = NULL;
|
||||
IDirect3DDevice9 *device = nil;
|
||||
#else
|
||||
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
((uint32)(uint8)(ch0) | ((uint32)(uint8)(ch1) << 8) | \
|
||||
|
@ -198,8 +196,8 @@ createIndexBuffer(uint32 length)
|
|||
uint16*
|
||||
lockIndices(void *indexBuffer, uint32 offset, uint32 size, uint32 flags)
|
||||
{
|
||||
if(indexBuffer == NULL)
|
||||
return NULL;
|
||||
if(indexBuffer == nil)
|
||||
return nil;
|
||||
#ifdef RW_D3D9
|
||||
uint16 *indices;
|
||||
IDirect3DIndexBuffer9 *ibuf = (IDirect3DIndexBuffer9*)indexBuffer;
|
||||
|
@ -216,7 +214,7 @@ lockIndices(void *indexBuffer, uint32 offset, uint32 size, uint32 flags)
|
|||
void
|
||||
unlockIndices(void *indexBuffer)
|
||||
{
|
||||
if(indexBuffer == NULL)
|
||||
if(indexBuffer == nil)
|
||||
return;
|
||||
#ifdef RW_D3D9
|
||||
IDirect3DIndexBuffer9 *ibuf = (IDirect3DIndexBuffer9*)indexBuffer;
|
||||
|
@ -241,8 +239,8 @@ createVertexBuffer(uint32 length, uint32 fvf, int32 pool)
|
|||
uint8*
|
||||
lockVertices(void *vertexBuffer, uint32 offset, uint32 size, uint32 flags)
|
||||
{
|
||||
if(vertexBuffer == NULL)
|
||||
return NULL;
|
||||
if(vertexBuffer == nil)
|
||||
return nil;
|
||||
#ifdef RW_D3D9
|
||||
uint8 *verts;
|
||||
IDirect3DVertexBuffer9 *vertbuf = (IDirect3DVertexBuffer9*)vertexBuffer;
|
||||
|
@ -259,7 +257,7 @@ lockVertices(void *vertexBuffer, uint32 offset, uint32 size, uint32 flags)
|
|||
void
|
||||
unlockVertices(void *vertexBuffer)
|
||||
{
|
||||
if(vertexBuffer == NULL)
|
||||
if(vertexBuffer == nil)
|
||||
return;
|
||||
#ifdef RW_D3D9
|
||||
IDirect3DVertexBuffer9 *vertbuf = (IDirect3DVertexBuffer9*)vertexBuffer;
|
||||
|
@ -273,7 +271,7 @@ createTexture(int32 width, int32 height, int32 numlevels, uint32 format)
|
|||
#ifdef RW_D3D9
|
||||
IDirect3DTexture9 *tex;
|
||||
device->CreateTexture(width, height, numlevels, 0,
|
||||
(D3DFORMAT)format, D3DPOOL_MANAGED, &tex, NULL);
|
||||
(D3DFORMAT)format, D3DPOOL_MANAGED, &tex, nil);
|
||||
return tex;
|
||||
#else
|
||||
int32 w = width;
|
||||
|
@ -336,7 +334,7 @@ unlockTexture(void *texture, int32 level)
|
|||
void
|
||||
deleteObject(void *object)
|
||||
{
|
||||
if(object == NULL)
|
||||
if(object == nil)
|
||||
return;
|
||||
#ifdef RW_D3D9
|
||||
IUnknown *unk = (IUnknown*)object;
|
||||
|
@ -560,8 +558,8 @@ static void*
|
|||
createNativeRaster(void *object, int32 offset, int32)
|
||||
{
|
||||
D3dRaster *raster = PLUGINOFFSET(D3dRaster, object, offset);
|
||||
raster->texture = NULL;
|
||||
raster->palette = NULL;
|
||||
raster->texture = nil;
|
||||
raster->palette = nil;
|
||||
raster->format = 0;
|
||||
raster->hasAlpha = 0;
|
||||
raster->customFormat = 0;
|
||||
|
@ -580,8 +578,8 @@ static void*
|
|||
copyNativeRaster(void *dst, void *, int32 offset, int32)
|
||||
{
|
||||
D3dRaster *raster = PLUGINOFFSET(D3dRaster, dst, offset);
|
||||
raster->texture = NULL;
|
||||
raster->palette = NULL;
|
||||
raster->texture = nil;
|
||||
raster->palette = nil;
|
||||
raster->format = 0;
|
||||
raster->hasAlpha = 0;
|
||||
raster->customFormat = 0;
|
||||
|
@ -596,19 +594,19 @@ registerNativeRaster(void)
|
|||
createNativeRaster,
|
||||
destroyNativeRaster,
|
||||
copyNativeRaster);
|
||||
engine[PLATFORM_D3D8].rasterNativeOffset = nativeRasterOffset;
|
||||
engine[PLATFORM_D3D8].rasterCreate = rasterCreate;
|
||||
engine[PLATFORM_D3D8].rasterLock = rasterLock;
|
||||
engine[PLATFORM_D3D8].rasterUnlock = rasterUnlock;
|
||||
engine[PLATFORM_D3D8].rasterNumLevels = rasterNumLevels;
|
||||
engine[PLATFORM_D3D8].rasterFromImage = rasterFromImage;
|
||||
driver[PLATFORM_D3D8].rasterNativeOffset = nativeRasterOffset;
|
||||
driver[PLATFORM_D3D8].rasterCreate = rasterCreate;
|
||||
driver[PLATFORM_D3D8].rasterLock = rasterLock;
|
||||
driver[PLATFORM_D3D8].rasterUnlock = rasterUnlock;
|
||||
driver[PLATFORM_D3D8].rasterNumLevels = rasterNumLevels;
|
||||
driver[PLATFORM_D3D8].rasterFromImage = rasterFromImage;
|
||||
|
||||
engine[PLATFORM_D3D9].rasterNativeOffset = nativeRasterOffset;
|
||||
engine[PLATFORM_D3D9].rasterCreate = rasterCreate;
|
||||
engine[PLATFORM_D3D9].rasterLock = rasterLock;
|
||||
engine[PLATFORM_D3D9].rasterUnlock = rasterUnlock;
|
||||
engine[PLATFORM_D3D9].rasterNumLevels = rasterNumLevels;
|
||||
engine[PLATFORM_D3D9].rasterFromImage = rasterFromImage;
|
||||
driver[PLATFORM_D3D9].rasterNativeOffset = nativeRasterOffset;
|
||||
driver[PLATFORM_D3D9].rasterCreate = rasterCreate;
|
||||
driver[PLATFORM_D3D9].rasterLock = rasterLock;
|
||||
driver[PLATFORM_D3D9].rasterUnlock = rasterUnlock;
|
||||
driver[PLATFORM_D3D9].rasterNumLevels = rasterNumLevels;
|
||||
driver[PLATFORM_D3D9].rasterFromImage = rasterFromImage;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ using namespace d3d;
|
|||
void
|
||||
initializePlatform(void)
|
||||
{
|
||||
engine[PLATFORM_D3D8].defaultPipeline = makeDefaultPipeline();
|
||||
driver[PLATFORM_D3D8].defaultPipeline = makeDefaultPipeline();
|
||||
}
|
||||
|
||||
uint32
|
||||
|
|
|
@ -28,7 +28,7 @@ using namespace d3d;
|
|||
void
|
||||
initializePlatform(void)
|
||||
{
|
||||
engine[PLATFORM_D3D9].defaultPipeline = makeDefaultPipeline();
|
||||
driver[PLATFORM_D3D9].defaultPipeline = makeDefaultPipeline();
|
||||
}
|
||||
|
||||
void*
|
||||
|
|
|
@ -110,14 +110,14 @@ setSamplerState(uint32 stage, uint32 type, uint32 value)
|
|||
void
|
||||
setRasterStage(uint32 stage, Raster *raster)
|
||||
{
|
||||
D3dRaster *d3draster = NULL;
|
||||
D3dRaster *d3draster = nil;
|
||||
if(raster != d3dRaster[stage]){
|
||||
d3dRaster[stage] = raster;
|
||||
if(raster){
|
||||
d3draster = PLUGINOFFSET(D3dRaster, raster, nativeRasterOffset);
|
||||
device->SetTexture(stage, (IDirect3DTexture9*)d3draster->texture);
|
||||
}else
|
||||
device->SetTexture(stage, NULL);
|
||||
device->SetTexture(stage, nil);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,8 @@ setTexture(uint32 stage, Texture *tex)
|
|||
0, D3DTADDRESS_WRAP, D3DTADDRESS_MIRROR,
|
||||
D3DTADDRESS_CLAMP, D3DTADDRESS_BORDER
|
||||
};
|
||||
if(tex == NULL){
|
||||
setRasterStage(stage, NULL);
|
||||
if(tex == nil){
|
||||
setRasterStage(stage, nil);
|
||||
return;
|
||||
}
|
||||
if(tex->raster){
|
||||
|
|
|
@ -10,10 +10,17 @@
|
|||
|
||||
namespace rw {
|
||||
|
||||
Engine engine[NUM_PLATFORMS];
|
||||
Engine engine;
|
||||
|
||||
Driver driver[NUM_PLATFORMS];
|
||||
|
||||
namespace null {
|
||||
|
||||
void beginUpdate(Camera*) { }
|
||||
|
||||
void endUpdate(Camera*) { }
|
||||
|
||||
|
||||
void
|
||||
rasterCreate(Raster*)
|
||||
{
|
||||
|
@ -24,7 +31,7 @@ uint8*
|
|||
rasterLock(Raster*, int32)
|
||||
{
|
||||
assert(0 && "lockRaster not implemented");
|
||||
return NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
124
src/frame.cpp
124
src/frame.cpp
|
@ -17,14 +17,14 @@ Frame*
|
|||
Frame::create(void)
|
||||
{
|
||||
Frame *f = (Frame*)malloc(PluginBase::s_size);
|
||||
if(f == NULL){
|
||||
if(f == nil){
|
||||
RWERROR((ERR_ALLOC, PluginBase::s_size));
|
||||
return NULL;
|
||||
return nil;
|
||||
}
|
||||
f->object.init(Frame::ID, 0);
|
||||
f->objectList.init();
|
||||
f->child = NULL;
|
||||
f->next = NULL;
|
||||
f->child = nil;
|
||||
f->next = nil;
|
||||
f->root = f;
|
||||
f->matrix.setIdentity();
|
||||
f->ltm.setIdentity();
|
||||
|
@ -35,7 +35,7 @@ Frame::create(void)
|
|||
Frame*
|
||||
Frame::cloneHierarchy(void)
|
||||
{
|
||||
Frame *frame = this->cloneAndLink(NULL);
|
||||
Frame *frame = this->cloneAndLink(nil);
|
||||
frame->purgeClone();
|
||||
return frame;
|
||||
}
|
||||
|
@ -56,12 +56,12 @@ Frame::destroy(void)
|
|||
;
|
||||
child->next = this->next;
|
||||
}
|
||||
this->object.parent = NULL;
|
||||
this->object.parent = nil;
|
||||
// Doesn't seem to make much sense, blame criterion.
|
||||
this->setHierarchyRoot(this);
|
||||
}
|
||||
for(Frame *f = this->child; f; f = f->next)
|
||||
f->object.parent = NULL;
|
||||
f->object.parent = nil;
|
||||
free(this);
|
||||
}
|
||||
|
||||
|
@ -84,13 +84,13 @@ Frame::addChild(Frame *child, bool32 append)
|
|||
if(child->getParent())
|
||||
child->removeChild();
|
||||
if(append){
|
||||
if(this->child == NULL)
|
||||
if(this->child == nil)
|
||||
this->child = child;
|
||||
else{
|
||||
for(c = this->child; c->next; c = c->next);
|
||||
c->next = child;
|
||||
}
|
||||
child->next = NULL;
|
||||
child->next = nil;
|
||||
}else{
|
||||
child->next = this->child;
|
||||
this->child = child;
|
||||
|
@ -99,6 +99,7 @@ Frame::addChild(Frame *child, bool32 append)
|
|||
child->root = this->root;
|
||||
for(c = child->child; c; c = c->next)
|
||||
c->setHierarchyRoot(this);
|
||||
// If the child was a root, remove from dirty list
|
||||
if(child->object.privateFlags & Frame::HIERARCHYSYNC){
|
||||
child->inDirtyList.remove();
|
||||
child->object.privateFlags &= ~Frame::HIERARCHYSYNC;
|
||||
|
@ -119,7 +120,7 @@ Frame::removeChild(void)
|
|||
child = child->next;
|
||||
child->next = this->next;
|
||||
}
|
||||
this->object.parent = this->next = NULL;
|
||||
this->object.parent = this->next = nil;
|
||||
this->root = this;
|
||||
for(child = this->child; child; child = child->next)
|
||||
child->setHierarchyRoot(this);
|
||||
|
@ -151,36 +152,74 @@ Frame::count(void)
|
|||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Synching is a bit complicated. If anything in the hierarchy is not synched,
|
||||
* the root of the hierarchy is marked with the HIERARCHYSYNC flags.
|
||||
* Every unsynched frame is marked with the SUBTREESYNC flags.
|
||||
* If the LTM is not synched, the LTM flags are set.
|
||||
* If attached objects need synching, the OBJ flags are set.
|
||||
*/
|
||||
|
||||
/* Synch just LTM matrices in a hierarchy */
|
||||
static void
|
||||
syncRecurse(Frame *frame, uint8 flags)
|
||||
syncLTMRecurse(Frame *frame, uint8 hierarchyFlags)
|
||||
{
|
||||
uint8 flg;
|
||||
for(; frame; frame = frame->next){
|
||||
flg = flags | frame->object.privateFlags;
|
||||
if(flg & Frame::SUBTREESYNCLTM){
|
||||
// If frame is dirty or any parent was dirty, update LTM
|
||||
hierarchyFlags |= frame->object.privateFlags;
|
||||
if(hierarchyFlags & Frame::SUBTREESYNCLTM){
|
||||
Matrix::mult(&frame->ltm, &frame->getParent()->ltm,
|
||||
&frame->matrix);
|
||||
frame->object.privateFlags &= ~Frame::SUBTREESYNCLTM;
|
||||
}
|
||||
syncRecurse(frame->child, flg);
|
||||
// And synch all children
|
||||
syncLTMRecurse(frame->child, hierarchyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
/* Synch just objects in a hierarchy */
|
||||
static void
|
||||
syncObjRecurse(Frame *frame)
|
||||
{
|
||||
for(; frame; frame = frame->next){
|
||||
// Synch attached objects
|
||||
FORLIST(lnk, frame->objectList)
|
||||
ObjectWithFrame::fromFrame(lnk)->sync();
|
||||
frame->object.privateFlags &= ~Frame::SUBTREESYNCOBJ;
|
||||
// And synch all children
|
||||
syncObjRecurse(frame->child);
|
||||
}
|
||||
}
|
||||
|
||||
/* Synch LTM and objects */
|
||||
static void
|
||||
syncRecurse(Frame *frame, uint8 hierarchyFlags)
|
||||
{
|
||||
for(; frame; frame = frame->next){
|
||||
// If frame is dirty or any parent was dirty, update LTM
|
||||
hierarchyFlags |= frame->object.privateFlags;
|
||||
if(hierarchyFlags & Frame::SUBTREESYNCLTM)
|
||||
Matrix::mult(&frame->ltm, &frame->getParent()->ltm,
|
||||
&frame->matrix);
|
||||
// Synch attached objects
|
||||
FORLIST(lnk, frame->objectList)
|
||||
ObjectWithFrame::fromFrame(lnk)->sync();
|
||||
frame->object.privateFlags &= ~Frame::SUBTREESYNC;
|
||||
// And synch all children
|
||||
syncRecurse(frame->child, hierarchyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
/* Sync the LTMs of the hierarchy of which 'this' is the root */
|
||||
void
|
||||
Frame::syncHierarchyLTM(void)
|
||||
{
|
||||
Frame *child;
|
||||
uint8 flg;
|
||||
// Sync root's LTM
|
||||
if(this->object.privateFlags & Frame::SUBTREESYNCLTM)
|
||||
this->ltm = this->matrix;
|
||||
for(child = this->child; child; child = child->next){
|
||||
flg = this->object.privateFlags | child->object.privateFlags;
|
||||
if(flg & Frame::SUBTREESYNCLTM){
|
||||
Matrix::mult(&child->ltm, &this->ltm, &child->matrix);
|
||||
child->object.privateFlags &= ~Frame::SUBTREESYNCLTM;
|
||||
}
|
||||
syncRecurse(child, flg);
|
||||
}
|
||||
// ...and children
|
||||
syncLTMRecurse(this->child, this->object.privateFlags);
|
||||
// all clean now
|
||||
this->object.privateFlags &= ~Frame::SYNCLTM;
|
||||
}
|
||||
|
||||
|
@ -192,12 +231,42 @@ Frame::getLTM(void)
|
|||
return &this->ltm;
|
||||
}
|
||||
|
||||
/* Synch all dirty frames; LTMs and objects */
|
||||
void
|
||||
Frame::syncDirty(void)
|
||||
{
|
||||
Frame *frame;
|
||||
FORLIST(lnk, Frame::dirtyList){
|
||||
frame = LLLinkGetData(lnk, Frame, inDirtyList);
|
||||
if(frame->object.privateFlags & Frame::HIERARCHYSYNCLTM){
|
||||
// Sync root's LTM
|
||||
if(frame->object.privateFlags & Frame::SUBTREESYNCLTM)
|
||||
frame->ltm = frame->matrix;
|
||||
// Synch attached objects
|
||||
FORLIST(lnk, frame->objectList)
|
||||
ObjectWithFrame::fromFrame(lnk)->sync();
|
||||
// ...and children
|
||||
syncRecurse(frame->child, frame->object.privateFlags);
|
||||
}else{
|
||||
// LTMs are clean, just synch objects
|
||||
FORLIST(lnk, frame->objectList)
|
||||
ObjectWithFrame::fromFrame(lnk)->sync();
|
||||
syncObjRecurse(frame->child);
|
||||
}
|
||||
// all clean now
|
||||
frame->object.privateFlags &= ~(Frame::SYNCLTM | Frame::SYNCOBJ);
|
||||
}
|
||||
Frame::dirtyList.init();
|
||||
}
|
||||
|
||||
void
|
||||
Frame::updateObjects(void)
|
||||
{
|
||||
// Mark root as dirty and insert into dirty list if necessary
|
||||
if((this->root->object.privateFlags & HIERARCHYSYNC) == 0)
|
||||
Frame::dirtyList.add(&this->inDirtyList);
|
||||
Frame::dirtyList.add(&this->root->inDirtyList);
|
||||
this->root->object.privateFlags |= HIERARCHYSYNC;
|
||||
// Mark subtree as dirty as well
|
||||
this->object.privateFlags |= SUBTREESYNC;
|
||||
}
|
||||
|
||||
|
@ -214,11 +283,10 @@ Frame*
|
|||
Frame::cloneAndLink(Frame *clonedroot)
|
||||
{
|
||||
Frame *frame = Frame::create();
|
||||
if(clonedroot == NULL)
|
||||
if(clonedroot == nil)
|
||||
clonedroot = frame;
|
||||
frame->object.copy(&this->object);
|
||||
frame->matrix = this->matrix;
|
||||
//memcpy(frame->matrix, this->matrix, sizeof(this->matrix));
|
||||
frame->root = clonedroot;
|
||||
this->root = frame; // Remember cloned frame
|
||||
for(Frame *child = this->child; child; child = child->next){
|
||||
|
|
|
@ -691,7 +691,7 @@ Raster::create(int32 width, int32 height, int32 depth, int32 format, int32 platf
|
|||
raster->texels = raster->palette = nil;
|
||||
raster->constructPlugins();
|
||||
|
||||
engine[raster->platform].rasterCreate(raster);
|
||||
driver[raster->platform].rasterCreate(raster);
|
||||
return raster;
|
||||
}
|
||||
|
||||
|
@ -707,19 +707,19 @@ Raster::destroy(void)
|
|||
uint8*
|
||||
Raster::lock(int32 level)
|
||||
{
|
||||
return engine[this->platform].rasterLock(this, level);
|
||||
return driver[this->platform].rasterLock(this, level);
|
||||
}
|
||||
|
||||
void
|
||||
Raster::unlock(int32 level)
|
||||
{
|
||||
engine[this->platform].rasterUnlock(this, level);
|
||||
driver[this->platform].rasterUnlock(this, level);
|
||||
}
|
||||
|
||||
int32
|
||||
Raster::getNumLevels(void)
|
||||
{
|
||||
return engine[this->platform].rasterNumLevels(this);
|
||||
return driver[this->platform].rasterNumLevels(this);
|
||||
}
|
||||
|
||||
int32
|
||||
|
@ -737,7 +737,7 @@ Raster::createFromImage(Image *image)
|
|||
{
|
||||
Raster *raster = Raster::create(image->width, image->height,
|
||||
image->depth, 4 | 0x80);
|
||||
engine[raster->platform].rasterFromImage(raster, image);
|
||||
driver[raster->platform].rasterFromImage(raster, image);
|
||||
return raster;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
|
||||
namespace rw {
|
||||
|
||||
static void
|
||||
lightSync(ObjectWithFrame*)
|
||||
{
|
||||
}
|
||||
|
||||
Light*
|
||||
Light::create(int32 type)
|
||||
{
|
||||
|
@ -20,6 +25,7 @@ Light::create(int32 type)
|
|||
return nil;
|
||||
}
|
||||
light->object.object.init(Light::ID, type);
|
||||
light->object.syncCB = lightSync;
|
||||
light->radius = 0.0f;
|
||||
light->color.red = 1.0f;
|
||||
light->color.green = 1.0f;
|
||||
|
|
|
@ -28,7 +28,7 @@ getPDSPipe(uint32 data)
|
|||
for(int32 i = 0; i < pdsGlobals.numPipes; i++)
|
||||
if(pdsGlobals.pipes[i]->pluginData == data)
|
||||
return pdsGlobals.pipes[i];
|
||||
return NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -60,10 +60,10 @@ registerPDSPlugin(int32 n)
|
|||
pdsGlobals.maxPipes = n;
|
||||
pdsGlobals.numPipes = 0;
|
||||
pdsGlobals.pipes = new Pipeline*[n];
|
||||
Atomic::registerPlugin(0, ID_PDS, NULL, NULL, NULL);
|
||||
Atomic::registerPlugin(0, ID_PDS, nil, nil, nil);
|
||||
Atomic::setStreamRightsCallback(ID_PDS, atomicPDSRights);
|
||||
|
||||
Material::registerPlugin(0, ID_PDS, NULL, NULL, NULL);
|
||||
Material::registerPlugin(0, ID_PDS, nil, nil, nil);
|
||||
Material::setStreamRightsCallback(ID_PDS, materialPDSRights);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#define COLOR_ARGB(a,r,g,b) \
|
||||
((uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace rw {
|
||||
|
||||
static void nothing(ObjPipeline *, Atomic*) {}
|
||||
|
@ -47,7 +45,9 @@ findMinVertAndNumVertices(uint16 *indices, uint32 numIndices, uint32 *minVert, i
|
|||
max = *indices;
|
||||
indices++;
|
||||
}
|
||||
if(minVert)
|
||||
*minVert = min;
|
||||
if(numVertices)
|
||||
*numVertices = max - min + 1;
|
||||
}
|
||||
|
||||
|
@ -128,16 +128,31 @@ uninstV2d(int type, float *dst, uint8 *src, uint32 numVertices, uint32 stride)
|
|||
bool32
|
||||
instColor(int type, uint8 *dst, uint8 *src, uint32 numVertices, uint32 stride)
|
||||
{
|
||||
assert(type == VERT_ARGB);
|
||||
bool32 hasAlpha = 0;
|
||||
if(type == VERT_ARGB){
|
||||
for(uint32 i = 0; i < numVertices; i++){
|
||||
dst[0] = src[2];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[0];
|
||||
dst[3] = src[3];
|
||||
if(dst[3] != 0xFF)
|
||||
hasAlpha = 1;
|
||||
dst += stride;
|
||||
src += 4;
|
||||
}
|
||||
}else if(type == VERT_RGBA){
|
||||
for(uint32 i = 0; i < numVertices; i++){
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
dst[3] = src[3];
|
||||
if(dst[3] != 0xFF)
|
||||
hasAlpha = 1;
|
||||
dst += stride;
|
||||
src += 4;
|
||||
}
|
||||
}else
|
||||
assert(0 && "unsupported color type");
|
||||
return hasAlpha;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,10 @@ HAnimHierarchy::create(int32 numNodes, int32 *nodeFlags, int32 *nodeIDs, int32 f
|
|||
hier->numNodes = numNodes;
|
||||
hier->flags = flags;
|
||||
hier->maxInterpKeyFrameSize = maxKeySize;
|
||||
hier->parentFrame = NULL;
|
||||
hier->parentFrame = nil;
|
||||
hier->parentHierarchy = hier;
|
||||
if(hier->flags & 2)
|
||||
hier->matrices = hier->matricesUnaligned = NULL;
|
||||
hier->matrices = hier->matricesUnaligned = nil;
|
||||
else{
|
||||
hier->matricesUnaligned =
|
||||
(float*) new uint8[hier->numNodes*64 + 15];
|
||||
|
@ -50,7 +50,7 @@ HAnimHierarchy::create(int32 numNodes, int32 *nodeFlags, int32 *nodeIDs, int32 f
|
|||
hier->nodeInfo[i].id = nodeIDs[i];
|
||||
hier->nodeInfo[i].index = i;
|
||||
hier->nodeInfo[i].flags = nodeFlags[i];
|
||||
hier->nodeInfo[i].frame = NULL;
|
||||
hier->nodeInfo[i].frame = nil;
|
||||
}
|
||||
return hier;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ HAnimHierarchy::destroy(void)
|
|||
static Frame*
|
||||
findById(Frame *f, int32 id)
|
||||
{
|
||||
if(f == NULL) return NULL;
|
||||
if(f == nil) return nil;
|
||||
HAnimData *hanim = HAnimData::get(f);
|
||||
if(hanim->id >= 0 && hanim->id == id) return f;
|
||||
Frame *ff = findById(f->next, id);
|
||||
|
@ -107,7 +107,7 @@ HAnimHierarchy::get(Frame *f)
|
|||
HAnimHierarchy*
|
||||
HAnimHierarchy::find(Frame *f)
|
||||
{
|
||||
if(f == NULL) return NULL;
|
||||
if(f == nil) return nil;
|
||||
HAnimHierarchy *hier = HAnimHierarchy::get(f);
|
||||
if(hier) return hier;
|
||||
hier = HAnimHierarchy::find(f->next);
|
||||
|
@ -126,7 +126,7 @@ createHAnim(void *object, int32 offset, int32)
|
|||
{
|
||||
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
|
||||
hanim->id = -1;
|
||||
hanim->hierarchy = NULL;
|
||||
hanim->hierarchy = nil;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ destroyHAnim(void *object, int32 offset, int32)
|
|||
if(hanim->hierarchy)
|
||||
hanim->hierarchy->destroy();
|
||||
hanim->id = -1;
|
||||
hanim->hierarchy = NULL;
|
||||
hanim->hierarchy = nil;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ copyHAnim(void *dst, void *src, int32 offset, int32)
|
|||
HAnimData *srchanim = PLUGINOFFSET(HAnimData, src, offset);
|
||||
dsthanim->id = srchanim->id;
|
||||
// TODO
|
||||
dsthanim->hierarchy = NULL;
|
||||
dsthanim->hierarchy = nil;
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ writeHAnim(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
|
||||
stream->writeI32(256);
|
||||
stream->writeI32(hanim->id);
|
||||
if(hanim->hierarchy == NULL){
|
||||
if(hanim->hierarchy == nil){
|
||||
stream->writeI32(0);
|
||||
return stream;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ getSizeHAnim(void *object, int32 offset, int32)
|
|||
{
|
||||
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
|
||||
if(!hAnimDoStream ||
|
||||
version >= 0x35000 && hanim->id == -1 && hanim->hierarchy == NULL)
|
||||
version >= 0x35000 && hanim->id == -1 && hanim->hierarchy == nil)
|
||||
return 0;
|
||||
if(hanim->hierarchy)
|
||||
return 12 + 8 + hanim->hierarchy->numNodes*12;
|
||||
|
@ -287,14 +287,14 @@ readMesh(Stream *stream, int32 len, void *object, int32, int32)
|
|||
geo->meshHeader->mesh = new Mesh[geo->meshHeader->numMeshes];
|
||||
Mesh *mesh = geo->meshHeader->mesh;
|
||||
bool hasData = len > 12+geo->meshHeader->numMeshes*8;
|
||||
uint16 *p = NULL;
|
||||
uint16 *p = nil;
|
||||
if(!(geo->geoflags & Geometry::NATIVE) || hasData)
|
||||
p = new uint16[geo->meshHeader->totalIndices];
|
||||
for(uint32 i = 0; i < geo->meshHeader->numMeshes; i++){
|
||||
stream->read(buf, 8);
|
||||
mesh->numIndices = buf[0];
|
||||
mesh->material = geo->materialList[buf[1]];
|
||||
mesh->indices = NULL;
|
||||
mesh->indices = nil;
|
||||
if(geo->geoflags & Geometry::NATIVE){
|
||||
// OpenGL stores uint16 indices here
|
||||
if(hasData){
|
||||
|
@ -339,7 +339,7 @@ writeMesh(Stream *stream, int32, void *object, int32, int32)
|
|||
geo->numMaterials);
|
||||
stream->write(buf, 8);
|
||||
if(geo->geoflags & Geometry::NATIVE){
|
||||
assert(geo->instData != NULL);
|
||||
assert(geo->instData != nil);
|
||||
if(geo->instData->platform == PLATFORM_WDGL)
|
||||
stream->write(mesh->indices,
|
||||
mesh->numIndices*2);
|
||||
|
@ -363,11 +363,11 @@ static int32
|
|||
getSizeMesh(void *object, int32, int32)
|
||||
{
|
||||
Geometry *geo = (Geometry*)object;
|
||||
if(geo->meshHeader == NULL)
|
||||
if(geo->meshHeader == nil)
|
||||
return -1;
|
||||
int32 size = 12 + geo->meshHeader->numMeshes*8;
|
||||
if(geo->geoflags & Geometry::NATIVE){
|
||||
assert(geo->instData != NULL);
|
||||
assert(geo->instData != nil);
|
||||
if(geo->instData->platform == PLATFORM_WDGL)
|
||||
size += geo->meshHeader->totalIndices*2;
|
||||
}else{
|
||||
|
@ -379,7 +379,7 @@ getSizeMesh(void *object, int32, int32)
|
|||
void
|
||||
registerMeshPlugin(void)
|
||||
{
|
||||
Geometry::registerPlugin(0, 0x50E, NULL, NULL, NULL);
|
||||
Geometry::registerPlugin(0, 0x50E, nil, nil, nil);
|
||||
Geometry::registerPluginStream(0x50E, readMesh, writeMesh, getSizeMesh);
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ static void*
|
|||
destroyNativeData(void *object, int32 offset, int32 size)
|
||||
{
|
||||
Geometry *geometry = (Geometry*)object;
|
||||
if(geometry->instData == NULL)
|
||||
if(geometry->instData == nil)
|
||||
return object;
|
||||
if(geometry->instData->platform == PLATFORM_PS2)
|
||||
return ps2::destroyNativeData(object, offset, size);
|
||||
|
@ -460,7 +460,7 @@ static Stream*
|
|||
writeNativeData(Stream *stream, int32 len, void *object, int32 o, int32 s)
|
||||
{
|
||||
Geometry *geometry = (Geometry*)object;
|
||||
if(geometry->instData == NULL)
|
||||
if(geometry->instData == nil)
|
||||
return stream;
|
||||
if(geometry->instData->platform == PLATFORM_PS2)
|
||||
return ps2::writeNativeData(stream, len, object, o, s);
|
||||
|
@ -479,7 +479,7 @@ static int32
|
|||
getSizeNativeData(void *object, int32 offset, int32 size)
|
||||
{
|
||||
Geometry *geometry = (Geometry*)object;
|
||||
if(geometry->instData == NULL)
|
||||
if(geometry->instData == nil)
|
||||
return 0;
|
||||
if(geometry->instData->platform == PLATFORM_PS2)
|
||||
return ps2::getSizeNativeData(object, offset, size);
|
||||
|
@ -498,7 +498,7 @@ void
|
|||
registerNativeDataPlugin(void)
|
||||
{
|
||||
Geometry::registerPlugin(0, ID_NATIVEDATA,
|
||||
NULL, destroyNativeData, NULL);
|
||||
nil, destroyNativeData, nil);
|
||||
Geometry::registerPluginStream(ID_NATIVEDATA,
|
||||
readNativeData,
|
||||
writeNativeData,
|
||||
|
@ -509,12 +509,12 @@ registerNativeDataPlugin(void)
|
|||
// Skin
|
||||
//
|
||||
|
||||
SkinGlobals skinGlobals = { 0, { NULL } };
|
||||
SkinGlobals skinGlobals = { 0, { nil } };
|
||||
|
||||
static void*
|
||||
createSkin(void *object, int32 offset, int32)
|
||||
{
|
||||
*PLUGINOFFSET(Skin*, object, offset) = NULL;
|
||||
*PLUGINOFFSET(Skin*, object, offset) = nil;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -534,10 +534,10 @@ static void*
|
|||
copySkin(void *dst, void *src, int32 offset, int32)
|
||||
{
|
||||
Skin *srcskin = *PLUGINOFFSET(Skin*, src, offset);
|
||||
if(srcskin == NULL)
|
||||
if(srcskin == nil)
|
||||
return dst;
|
||||
Geometry *geometry = (Geometry*)src;
|
||||
assert(geometry->instData == NULL);
|
||||
assert(geometry->instData == nil);
|
||||
assert(((Geometry*)src)->numVertices == ((Geometry*)dst)->numVertices);
|
||||
Skin *dstskin = new Skin;
|
||||
*PLUGINOFFSET(Skin*, dst, offset) = dstskin;
|
||||
|
@ -695,7 +695,7 @@ getSizeSkin(void *object, int32 offset, int32)
|
|||
}
|
||||
|
||||
Skin *skin = *PLUGINOFFSET(Skin*, object, offset);
|
||||
if(skin == NULL)
|
||||
if(skin == nil)
|
||||
return -1;
|
||||
|
||||
int32 size = 4 + geometry->numVertices*(16+4) +
|
||||
|
@ -717,7 +717,7 @@ skinRights(void *object, int32, int32, uint32)
|
|||
void
|
||||
registerSkinPlugin(void)
|
||||
{
|
||||
ObjPipeline *defpipe = new ObjPipeline(PLATFORM_NULL);
|
||||
ObjPipeline *defpipe = new ObjPipeline(PLATFORM_nil);
|
||||
defpipe->pluginID = ID_SKIN;
|
||||
defpipe->pluginData = 1;
|
||||
for(uint i = 0; i < nelem(skinGlobals.pipelines); i++)
|
||||
|
@ -739,7 +739,7 @@ registerSkinPlugin(void)
|
|||
copySkin);
|
||||
Geometry::registerPluginStream(ID_SKIN,
|
||||
readSkin, writeSkin, getSizeSkin);
|
||||
Atomic::registerPlugin(0, ID_SKIN, NULL, NULL, NULL);
|
||||
Atomic::registerPlugin(0, ID_SKIN, nil, nil, nil);
|
||||
Atomic::setStreamRightsCallback(ID_SKIN, skinRights);
|
||||
}
|
||||
|
||||
|
@ -754,30 +754,30 @@ Skin::init(int32 numBones, int32 numUsedBones, int32 numVertices)
|
|||
this->data = new uint8[size];
|
||||
uint8 *p = this->data;
|
||||
|
||||
this->usedBones = NULL;
|
||||
this->usedBones = nil;
|
||||
if(this->numUsedBones){
|
||||
this->usedBones = p;
|
||||
p += this->numUsedBones;
|
||||
}
|
||||
|
||||
p = (uint8*)(((uintptr)p + 0xF) & ~0xF);
|
||||
this->inverseMatrices = NULL;
|
||||
this->inverseMatrices = nil;
|
||||
if(this->numBones){
|
||||
this->inverseMatrices = (float*)p;
|
||||
p += 64*this->numBones;
|
||||
}
|
||||
|
||||
this->indices = NULL;
|
||||
this->indices = nil;
|
||||
if(numVertices){
|
||||
this->indices = p;
|
||||
p += 4*numVertices;
|
||||
}
|
||||
|
||||
this->weights = NULL;
|
||||
this->weights = nil;
|
||||
if(numVertices)
|
||||
this->weights = (float*)p;
|
||||
|
||||
this->platformData = NULL;
|
||||
this->platformData = nil;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -871,7 +871,7 @@ getSizeAtomicMatFX(void *object, int32 offset, int32)
|
|||
|
||||
// Material
|
||||
|
||||
MatFXGlobals matFXGlobals = { 0, 0, { NULL } };
|
||||
MatFXGlobals matFXGlobals = { 0, 0, { nil } };
|
||||
|
||||
// TODO: Frames and Matrices?
|
||||
static void
|
||||
|
@ -1003,7 +1003,7 @@ MatFX::setDualDestBlend(int32 blend)
|
|||
static void*
|
||||
createMaterialMatFX(void *object, int32 offset, int32)
|
||||
{
|
||||
*PLUGINOFFSET(MatFX*, object, offset) = NULL;
|
||||
*PLUGINOFFSET(MatFX*, object, offset) = nil;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ static void*
|
|||
copyMaterialMatFX(void *dst, void *src, int32 offset, int32)
|
||||
{
|
||||
MatFX *srcfx = *PLUGINOFFSET(MatFX*, src, offset);
|
||||
if(srcfx == NULL)
|
||||
if(srcfx == nil)
|
||||
return dst;
|
||||
MatFX *dstfx = new MatFX;
|
||||
*PLUGINOFFSET(MatFX*, dst, offset) = dstfx;
|
||||
|
@ -1068,10 +1068,10 @@ readMaterialMatFX(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
switch(type){
|
||||
case MatFX::BUMPMAP:
|
||||
coefficient = stream->readF32();
|
||||
bumpedTex = tex = NULL;
|
||||
bumpedTex = tex = nil;
|
||||
if(stream->readI32()){
|
||||
if(!findChunk(stream, ID_TEXTURE,
|
||||
NULL, NULL)){
|
||||
nil, nil)){
|
||||
RWERROR((ERR_CHUNK, "TEXTURE"));
|
||||
return nil;
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ readMaterialMatFX(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
}
|
||||
if(stream->readI32()){
|
||||
if(!findChunk(stream, ID_TEXTURE,
|
||||
NULL, NULL)){
|
||||
nil, nil)){
|
||||
RWERROR((ERR_CHUNK, "TEXTURE"));
|
||||
return nil;
|
||||
}
|
||||
|
@ -1095,10 +1095,10 @@ readMaterialMatFX(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
case MatFX::ENVMAP:
|
||||
coefficient = stream->readF32();
|
||||
fbAlpha = stream->readI32();
|
||||
tex = NULL;
|
||||
tex = nil;
|
||||
if(stream->readI32()){
|
||||
if(!findChunk(stream, ID_TEXTURE,
|
||||
NULL, NULL)){
|
||||
nil, nil)){
|
||||
RWERROR((ERR_CHUNK, "TEXTURE"));
|
||||
return nil;
|
||||
}
|
||||
|
@ -1114,10 +1114,10 @@ readMaterialMatFX(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
case MatFX::DUAL:
|
||||
srcBlend = stream->readI32();
|
||||
dstBlend = stream->readI32();
|
||||
tex = NULL;
|
||||
tex = nil;
|
||||
if(stream->readI32()){
|
||||
if(!findChunk(stream, ID_TEXTURE,
|
||||
NULL, NULL)){
|
||||
nil, nil)){
|
||||
RWERROR((ERR_CHUNK, "TEXTURE"));
|
||||
return nil;
|
||||
}
|
||||
|
@ -1145,10 +1145,10 @@ writeMaterialMatFX(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
switch(matfx->fx[i].type){
|
||||
case MatFX::BUMPMAP:
|
||||
stream->writeF32(matfx->fx[i].bump.coefficient);
|
||||
stream->writeI32(matfx->fx[i].bump.bumpedTex != NULL);
|
||||
stream->writeI32(matfx->fx[i].bump.bumpedTex != nil);
|
||||
if(matfx->fx[i].bump.bumpedTex)
|
||||
matfx->fx[i].bump.bumpedTex->streamWrite(stream);
|
||||
stream->writeI32(matfx->fx[i].bump.tex != NULL);
|
||||
stream->writeI32(matfx->fx[i].bump.tex != nil);
|
||||
if(matfx->fx[i].bump.tex)
|
||||
matfx->fx[i].bump.tex->streamWrite(stream);
|
||||
break;
|
||||
|
@ -1156,7 +1156,7 @@ writeMaterialMatFX(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
case MatFX::ENVMAP:
|
||||
stream->writeF32(matfx->fx[i].env.coefficient);
|
||||
stream->writeI32(matfx->fx[i].env.fbAlpha);
|
||||
stream->writeI32(matfx->fx[i].env.tex != NULL);
|
||||
stream->writeI32(matfx->fx[i].env.tex != nil);
|
||||
if(matfx->fx[i].env.tex)
|
||||
matfx->fx[i].env.tex->streamWrite(stream);
|
||||
break;
|
||||
|
@ -1164,7 +1164,7 @@ writeMaterialMatFX(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
case MatFX::DUAL:
|
||||
stream->writeI32(matfx->fx[i].dual.srcBlend);
|
||||
stream->writeI32(matfx->fx[i].dual.dstBlend);
|
||||
stream->writeI32(matfx->fx[i].dual.tex != NULL);
|
||||
stream->writeI32(matfx->fx[i].dual.tex != nil);
|
||||
if(matfx->fx[i].dual.tex)
|
||||
matfx->fx[i].dual.tex->streamWrite(stream);
|
||||
break;
|
||||
|
@ -1177,7 +1177,7 @@ static int32
|
|||
getSizeMaterialMatFX(void *object, int32 offset, int32)
|
||||
{
|
||||
MatFX *matfx = *PLUGINOFFSET(MatFX*, object, offset);
|
||||
if(matfx == NULL)
|
||||
if(matfx == nil)
|
||||
return -1;
|
||||
int32 size = 4 + 4 + 4;
|
||||
|
||||
|
@ -1220,7 +1220,7 @@ MatFX::enableEffects(Atomic *atomic)
|
|||
void
|
||||
registerMatFXPlugin(void)
|
||||
{
|
||||
ObjPipeline *defpipe = new ObjPipeline(PLATFORM_NULL);
|
||||
ObjPipeline *defpipe = new ObjPipeline(PLATFORM_nil);
|
||||
defpipe->pluginID = 0; //ID_MATFX;
|
||||
defpipe->pluginData = 0;
|
||||
for(uint i = 0; i < nelem(matFXGlobals.pipelines); i++)
|
||||
|
@ -1238,7 +1238,7 @@ registerMatFXPlugin(void)
|
|||
|
||||
matFXGlobals.atomicOffset =
|
||||
Atomic::registerPlugin(sizeof(int32), ID_MATFX,
|
||||
createAtomicMatFX, NULL, copyAtomicMatFX);
|
||||
createAtomicMatFX, nil, copyAtomicMatFX);
|
||||
Atomic::registerPluginStream(ID_MATFX,
|
||||
readAtomicMatFX,
|
||||
writeAtomicMatFX,
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace ps2 {
|
|||
void
|
||||
initializePlatform(void)
|
||||
{
|
||||
engine[PLATFORM_PS2].defaultPipeline = makeDefaultPipeline();
|
||||
driver[PLATFORM_PS2].defaultPipeline = makeDefaultPipeline();
|
||||
}
|
||||
|
||||
ObjPipeline *defaultObjPipe;
|
||||
|
|
|
@ -484,11 +484,11 @@ registerNativeRaster(void)
|
|||
createNativeRaster,
|
||||
destroyNativeRaster,
|
||||
copyNativeRaster);
|
||||
engine[PLATFORM_PS2].rasterNativeOffset = nativeRasterOffset;
|
||||
engine[PLATFORM_PS2].rasterCreate = rasterCreate;
|
||||
engine[PLATFORM_PS2].rasterLock = rasterLock;
|
||||
engine[PLATFORM_PS2].rasterUnlock = rasterUnlock;
|
||||
engine[PLATFORM_PS2].rasterNumLevels = rasterNumLevels;
|
||||
driver[PLATFORM_PS2].rasterNativeOffset = nativeRasterOffset;
|
||||
driver[PLATFORM_PS2].rasterCreate = rasterCreate;
|
||||
driver[PLATFORM_PS2].rasterLock = rasterLock;
|
||||
driver[PLATFORM_PS2].rasterUnlock = rasterUnlock;
|
||||
driver[PLATFORM_PS2].rasterNumLevels = rasterNumLevels;
|
||||
|
||||
Texture::registerPlugin(0, ID_SKYMIPMAP, nil, nil, nil);
|
||||
Texture::registerPluginStream(ID_SKYMIPMAP, readMipmap, writeMipmap, getSizeMipmap);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include "rwd3d9.h"
|
||||
#include "rwwdgl.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace rw {
|
||||
|
||||
#define PLUGIN_ID 0
|
||||
|
@ -33,9 +31,9 @@ int32 build = 0xFFFF;
|
|||
#elif RW_D3D9
|
||||
int32 platform = PLATFORM_D3D9;
|
||||
#else
|
||||
int32 platform = PLATFORM_NULL;
|
||||
int32 platform = PLATFORM_nil;
|
||||
#endif
|
||||
char *debugFile = NULL;
|
||||
char *debugFile = nil;
|
||||
|
||||
// TODO: comparison tolerances
|
||||
|
||||
|
@ -55,15 +53,18 @@ static Matrix3 identMat3 = {
|
|||
void
|
||||
initialize(void)
|
||||
{
|
||||
ObjPipeline *defpipe = new ObjPipeline(PLATFORM_NULL);
|
||||
ObjPipeline *defpipe = new ObjPipeline(PLATFORM_nil);
|
||||
for(uint i = 0; i < NUM_PLATFORMS; i++){
|
||||
engine[i].defaultPipeline = defpipe;
|
||||
driver[i].defaultPipeline = defpipe;
|
||||
|
||||
engine[i].rasterCreate = null::rasterCreate;
|
||||
engine[i].rasterLock = null::rasterLock;
|
||||
engine[i].rasterUnlock = null::rasterUnlock;
|
||||
engine[i].rasterNumLevels = null::rasterNumLevels;
|
||||
engine[i].rasterFromImage = null::rasterFromImage;
|
||||
driver[i].beginUpdate = null::beginUpdate;
|
||||
driver[i].endUpdate = null::endUpdate;
|
||||
|
||||
driver[i].rasterCreate = null::rasterCreate;
|
||||
driver[i].rasterLock = null::rasterLock;
|
||||
driver[i].rasterUnlock = null::rasterUnlock;
|
||||
driver[i].rasterNumLevels = null::rasterNumLevels;
|
||||
driver[i].rasterFromImage = null::rasterFromImage;
|
||||
}
|
||||
|
||||
|
||||
|
@ -668,9 +669,9 @@ StreamFile*
|
|||
StreamFile::open(const char *path, const char *mode)
|
||||
{
|
||||
this->file = fopen(path, mode);
|
||||
if(this->file == NULL){
|
||||
if(this->file == nil){
|
||||
RWERROR((ERR_FILE, path));
|
||||
return NULL;
|
||||
return nil;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -732,7 +733,7 @@ readChunkHeaderInfo(Stream *s, ChunkHeaderInfo *header)
|
|||
s->read(&buf, 12);
|
||||
if(s->eof())
|
||||
return false;
|
||||
assert(header != NULL);
|
||||
assert(header != nil);
|
||||
header->type = buf.type;
|
||||
header->length = buf.size;
|
||||
header->version = libraryIDUnpackVersion(buf.id);
|
||||
|
@ -773,7 +774,7 @@ uint8*
|
|||
getFileContents(char *name, uint32 *len)
|
||||
{
|
||||
FILE *cf = fopen(name, "rb");
|
||||
assert(cf != NULL);
|
||||
assert(cf != nil);
|
||||
fseek(cf, 0, SEEK_END);
|
||||
*len = ftell(cf);
|
||||
fseek(cf, 0, SEEK_SET);
|
||||
|
|
|
@ -227,7 +227,7 @@ public:
|
|||
|
||||
enum Platform
|
||||
{
|
||||
PLATFORM_NULL = 0,
|
||||
PLATFORM_nil = 0,
|
||||
// D3D7
|
||||
PLATFORM_GL = 2,
|
||||
// MAC
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
namespace rw {
|
||||
|
||||
// TODO: move more stuff into this
|
||||
|
||||
struct Engine
|
||||
{
|
||||
Camera *currentCamera;
|
||||
};
|
||||
|
||||
extern Engine engine;
|
||||
|
||||
|
||||
struct Driver
|
||||
{
|
||||
ObjPipeline *defaultPipeline;
|
||||
int32 rasterNativeOffset;
|
||||
|
||||
void (*beginUpdate)(Camera*);
|
||||
void (*endUpdate)(Camera*);
|
||||
|
||||
void (*rasterCreate)(Raster*);
|
||||
uint8 *(*rasterLock)(Raster*, int32 level);
|
||||
void (*rasterUnlock)(Raster*, int32 level);
|
||||
|
@ -12,9 +25,13 @@ struct Engine
|
|||
void (*rasterFromImage)(Raster*, Image*);
|
||||
};
|
||||
|
||||
extern Engine engine[NUM_PLATFORMS];
|
||||
extern Driver driver[NUM_PLATFORMS];
|
||||
#define DRIVER driver[rw::platform]
|
||||
|
||||
namespace null {
|
||||
void beginUpdate(Camera*);
|
||||
void endUpdate(Camera*);
|
||||
|
||||
void rasterCreate(Raster*);
|
||||
uint8 *rasterLock(Raster*, int32 level);
|
||||
void rasterUnlock(Raster*, int32 level);
|
||||
|
|
|
@ -7,8 +7,8 @@ struct LLLink
|
|||
LLLink *next;
|
||||
LLLink *prev;
|
||||
void init(void){
|
||||
this->next = NULL;
|
||||
this->prev = NULL;
|
||||
this->next = nil;
|
||||
this->prev = nil;
|
||||
}
|
||||
void remove(void){
|
||||
this->prev->next = this->next;
|
||||
|
@ -21,7 +21,7 @@ struct LLLink
|
|||
|
||||
// Have to be careful since the link might be deleted.
|
||||
#define FORLIST(_link, _list) \
|
||||
for(rw::LLLink *_next = NULL, *_link = (_list).link.next; \
|
||||
for(rw::LLLink *_next = nil, *_link = (_list).link.next; \
|
||||
_next = (_link)->next, (_link) != (_list).end(); \
|
||||
(_link) = _next)
|
||||
|
||||
|
@ -71,14 +71,14 @@ struct Object
|
|||
this->subType = subType;
|
||||
this->flags = 0;
|
||||
this->privateFlags = 0;
|
||||
this->parent = NULL;
|
||||
this->parent = nil;
|
||||
}
|
||||
void copy(Object *o){
|
||||
this->type = o->type;
|
||||
this->subType = o->subType;
|
||||
this->flags = o->flags;
|
||||
this->privateFlags = o->privateFlags;
|
||||
this->parent = NULL;
|
||||
this->parent = nil;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -87,9 +87,11 @@ struct Frame : PluginBase<Frame>
|
|||
typedef Frame *(*Callback)(Frame *f, void *data);
|
||||
enum { ID = 0 };
|
||||
enum { // private flags
|
||||
HIERARCHYSYNCLTM = 0x01,
|
||||
HIERARCHYSYNCOBJ = 0x02,
|
||||
// The hierarchy has unsynched frames
|
||||
HIERARCHYSYNCLTM = 0x01, // LTM not synched
|
||||
HIERARCHYSYNCOBJ = 0x02, // attached objects not synched
|
||||
HIERARCHYSYNC = HIERARCHYSYNCLTM | HIERARCHYSYNCOBJ,
|
||||
// This frame is not synched
|
||||
SUBTREESYNCLTM = 0x04,
|
||||
SUBTREESYNCOBJ = 0x08,
|
||||
SUBTREESYNC = SUBTREESYNCLTM | SUBTREESYNCOBJ,
|
||||
|
@ -107,8 +109,6 @@ struct Frame : PluginBase<Frame>
|
|||
Frame *next;
|
||||
Frame *root;
|
||||
|
||||
static LinkList dirtyList;
|
||||
|
||||
static Frame *create(void);
|
||||
Frame *cloneHierarchy(void);
|
||||
void destroy(void);
|
||||
|
@ -124,10 +124,15 @@ struct Frame : PluginBase<Frame>
|
|||
Matrix *getLTM(void);
|
||||
void updateObjects(void);
|
||||
|
||||
|
||||
void syncHierarchyLTM(void);
|
||||
void setHierarchyRoot(Frame *root);
|
||||
Frame *cloneAndLink(Frame *clonedroot);
|
||||
void purgeClone(void);
|
||||
|
||||
|
||||
static LinkList dirtyList;
|
||||
static void syncDirty(void);
|
||||
};
|
||||
|
||||
struct FrameList_
|
||||
|
@ -145,6 +150,8 @@ struct ObjectWithFrame
|
|||
{
|
||||
Object object;
|
||||
LLLink inFrame;
|
||||
void (*syncCB)(ObjectWithFrame*);
|
||||
|
||||
void setFrame(Frame *f){
|
||||
if(this->object.parent)
|
||||
this->inFrame.remove();
|
||||
|
@ -152,6 +159,7 @@ struct ObjectWithFrame
|
|||
if(f)
|
||||
f->objectList.add(&this->inFrame);
|
||||
}
|
||||
void sync(void){ this->syncCB(this); }
|
||||
static ObjectWithFrame *fromFrame(LLLink *lnk){
|
||||
return LLLinkGetData(lnk, ObjectWithFrame, inFrame);
|
||||
}
|
||||
|
@ -380,7 +388,7 @@ struct Geometry : PluginBase<Geometry>
|
|||
void calculateBoundingSphere(void);
|
||||
bool32 hasColoredMaterial(void);
|
||||
void allocateData(void);
|
||||
void generateTriangles(int8 *adc = NULL);
|
||||
void generateTriangles(int8 *adc = nil);
|
||||
void buildMeshes(void);
|
||||
void removeUnusedMaterials(void);
|
||||
|
||||
|
@ -503,6 +511,9 @@ struct Camera : PluginBase<Camera>
|
|||
Clump *clump;
|
||||
LLLink inClump;
|
||||
|
||||
void (*beginUpdateCB)(Camera*);
|
||||
void (*endUpdateCB)(Camera*);
|
||||
|
||||
static Camera *create(void);
|
||||
Camera *clone(void);
|
||||
void destroy(void);
|
||||
|
@ -510,6 +521,8 @@ struct Camera : PluginBase<Camera>
|
|||
Frame *getFrame(void){ return (Frame*)this->object.object.parent; }
|
||||
static Camera *fromClump(LLLink *lnk){
|
||||
return LLLinkGetData(lnk, Camera, inClump); }
|
||||
void beginUpdate(void) { this->beginUpdateCB(this); }
|
||||
void endUpdate(void) { this->endUpdateCB(this); }
|
||||
static Camera *streamRead(Stream *stream);
|
||||
bool streamWrite(Stream *stream);
|
||||
uint32 streamGetSize(void);
|
||||
|
|
|
@ -42,6 +42,7 @@ enum {
|
|||
VERT_FLOAT2,
|
||||
VERT_FLOAT3,
|
||||
VERT_ARGB,
|
||||
VERT_RGBA,
|
||||
VERT_COMPNORM
|
||||
};
|
||||
|
||||
|
|
16
src/rwplg.h
16
src/rwplg.h
|
@ -86,7 +86,7 @@ PluginBase<T>::streamReadPlugins(Stream *stream)
|
|||
{
|
||||
int32 length;
|
||||
ChunkHeaderInfo header;
|
||||
if(!findChunk(stream, ID_EXTENSION, (uint32*)&length, NULL))
|
||||
if(!findChunk(stream, ID_EXTENSION, (uint32*)&length, nil))
|
||||
return false;
|
||||
while(length > 0){
|
||||
if(!readChunkHeaderInfo(stream, &header))
|
||||
|
@ -112,7 +112,7 @@ PluginBase<T>::streamWritePlugins(Stream *stream)
|
|||
int size = this->streamGetPluginSize();
|
||||
writeChunkHeader(stream, ID_EXTENSION, size);
|
||||
for(Plugin *p = this->s_plugins; p; p = p->next){
|
||||
if(p->getSize == NULL ||
|
||||
if(p->getSize == nil ||
|
||||
(size = p->getSize(this, p->offset, p->size)) <= 0)
|
||||
continue;
|
||||
writeChunkHeader(stream, p->id, size);
|
||||
|
@ -157,16 +157,16 @@ PluginBase<T>::registerPlugin(int32 size, uint32 id,
|
|||
p->constructor = ctor;
|
||||
p->copy = cctor;
|
||||
p->destructor = dtor;
|
||||
p->read = NULL;
|
||||
p->write = NULL;
|
||||
p->getSize = NULL;
|
||||
p->rightsCallback = NULL;
|
||||
p->read = nil;
|
||||
p->write = nil;
|
||||
p->getSize = nil;
|
||||
p->rightsCallback = nil;
|
||||
|
||||
Plugin **next;
|
||||
for(next = &s_plugins; *next; next = &(*next)->next)
|
||||
;
|
||||
*next = p;
|
||||
p->next = NULL;
|
||||
p->next = nil;
|
||||
return p->offset;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ template <typename T> void*
|
|||
PluginBase<T>::operator new(size_t)
|
||||
{
|
||||
abort();
|
||||
return NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <typename T> void
|
||||
|
|
20
src/wdgl.cpp
20
src/wdgl.cpp
|
@ -24,7 +24,7 @@ namespace wdgl {
|
|||
void
|
||||
initializePlatform(void)
|
||||
{
|
||||
engine[PLATFORM_WDGL].defaultPipeline = makeDefaultPipeline();
|
||||
driver[PLATFORM_WDGL].defaultPipeline = makeDefaultPipeline();
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,7 +223,7 @@ destroyNativeData(void *object, int32, int32)
|
|||
return object;
|
||||
InstanceDataHeader *header =
|
||||
(InstanceDataHeader*)geometry->instData;
|
||||
geometry->instData = NULL;
|
||||
geometry->instData = nil;
|
||||
// TODO: delete ibo and vbo
|
||||
delete[] header->attribs;
|
||||
delete[] header->data;
|
||||
|
@ -279,7 +279,7 @@ void
|
|||
registerNativeDataPlugin(void)
|
||||
{
|
||||
Geometry::registerPlugin(0, ID_NATIVEDATA,
|
||||
NULL, destroyNativeData, NULL);
|
||||
nil, destroyNativeData, nil);
|
||||
Geometry::registerPluginStream(ID_NATIVEDATA,
|
||||
readNativeData,
|
||||
writeNativeData,
|
||||
|
@ -290,7 +290,7 @@ void
|
|||
printPipeinfo(Atomic *a)
|
||||
{
|
||||
Geometry *g = a->geometry;
|
||||
if(g->instData == NULL || g->instData->platform != PLATFORM_WDGL)
|
||||
if(g->instData == nil || g->instData->platform != PLATFORM_WDGL)
|
||||
return;
|
||||
int32 plgid = 0;
|
||||
if(a->pipeline)
|
||||
|
@ -436,7 +436,7 @@ uninstance(rw::ObjPipeline *rwpipe, Atomic *atomic)
|
|||
Geometry *geo = atomic->geometry;
|
||||
if((geo->geoflags & Geometry::NATIVE) == 0)
|
||||
return;
|
||||
assert(geo->instData != NULL);
|
||||
assert(geo->instData != nil);
|
||||
assert(geo->instData->platform == PLATFORM_WDGL);
|
||||
geo->geoflags &= ~Geometry::NATIVE;
|
||||
geo->allocateData();
|
||||
|
@ -507,8 +507,8 @@ ObjPipeline::ObjPipeline(uint32 platform)
|
|||
this->numCustomAttribs = 0;
|
||||
this->impl.instance = wdgl::instance;
|
||||
this->impl.uninstance = wdgl::uninstance;
|
||||
this->instanceCB = NULL;
|
||||
this->uninstanceCB = NULL;
|
||||
this->instanceCB = nil;
|
||||
this->uninstanceCB = nil;
|
||||
}
|
||||
|
||||
ObjPipeline*
|
||||
|
@ -558,7 +558,7 @@ int32
|
|||
getSizeNativeSkin(void *object, int32 offset)
|
||||
{
|
||||
Skin *skin = *PLUGINOFFSET(Skin*, object, offset);
|
||||
if(skin == NULL)
|
||||
if(skin == nil)
|
||||
return -1;
|
||||
int32 size = 12 + 4 + 4 + skin->numBones*64;
|
||||
return size;
|
||||
|
@ -590,7 +590,7 @@ skinInstanceCB(Geometry *g, int32 i, uint32 offset)
|
|||
header->data = new uint8[header->dataSize];
|
||||
|
||||
Skin *skin = *PLUGINOFFSET(Skin*, g, skinGlobals.offset);
|
||||
if(skin == NULL)
|
||||
if(skin == nil)
|
||||
return 8;
|
||||
|
||||
a = &header->attribs[i];
|
||||
|
@ -618,7 +618,7 @@ skinUninstanceCB(Geometry *geo)
|
|||
InstanceDataHeader *header = (InstanceDataHeader*)geo->instData;
|
||||
|
||||
Skin *skin = *PLUGINOFFSET(Skin*, geo, skinGlobals.offset);
|
||||
if(skin == NULL)
|
||||
if(skin == nil)
|
||||
return;
|
||||
|
||||
uint8 *data = skin->data;
|
||||
|
|
42
src/xbox.cpp
42
src/xbox.cpp
|
@ -20,7 +20,7 @@ namespace xbox {
|
|||
void
|
||||
initializePlatform(void)
|
||||
{
|
||||
engine[PLATFORM_XBOX].defaultPipeline = makeDefaultPipeline();
|
||||
driver[PLATFORM_XBOX].defaultPipeline = makeDefaultPipeline();
|
||||
}
|
||||
|
||||
void*
|
||||
|
@ -32,7 +32,7 @@ destroyNativeData(void *object, int32, int32)
|
|||
return object;
|
||||
InstanceDataHeader *header =
|
||||
(InstanceDataHeader*)geometry->instData;
|
||||
geometry->instData = NULL;
|
||||
geometry->instData = nil;
|
||||
delete[] (uint8*)header->vertexBuffer;
|
||||
delete[] header->begin;
|
||||
delete[] header->data;
|
||||
|
@ -156,7 +156,7 @@ void
|
|||
registerNativeDataPlugin(void)
|
||||
{
|
||||
Geometry::registerPlugin(0, ID_NATIVEDATA,
|
||||
NULL, destroyNativeData, NULL);
|
||||
nil, destroyNativeData, nil);
|
||||
Geometry::registerPluginStream(ID_NATIVEDATA,
|
||||
readNativeData,
|
||||
writeNativeData,
|
||||
|
@ -195,7 +195,7 @@ instance(rw::ObjPipeline *rwpipe, Atomic *atomic)
|
|||
header->vertexAlpha = 0;
|
||||
// set by the instanceCB
|
||||
header->stride = 0;
|
||||
header->vertexBuffer = NULL;
|
||||
header->vertexBuffer = nil;
|
||||
|
||||
InstanceData *inst = new InstanceData[header->numMeshes];
|
||||
header->begin = inst;
|
||||
|
@ -225,7 +225,7 @@ uninstance(rw::ObjPipeline *rwpipe, Atomic *atomic)
|
|||
Geometry *geo = atomic->geometry;
|
||||
if((geo->geoflags & Geometry::NATIVE) == 0)
|
||||
return;
|
||||
assert(geo->instData != NULL);
|
||||
assert(geo->instData != nil);
|
||||
assert(geo->instData->platform == PLATFORM_XBOX);
|
||||
geo->geoflags &= ~Geometry::NATIVE;
|
||||
geo->allocateData();
|
||||
|
@ -251,8 +251,8 @@ ObjPipeline::ObjPipeline(uint32 platform)
|
|||
{
|
||||
this->impl.instance = xbox::instance;
|
||||
this->impl.uninstance = xbox::uninstance;
|
||||
this->instanceCB = NULL;
|
||||
this->uninstanceCB = NULL;
|
||||
this->instanceCB = nil;
|
||||
this->uninstanceCB = nil;
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,9 +435,9 @@ getSizeNativeSkin(void *object, int32 offset)
|
|||
{
|
||||
Geometry *geometry = (Geometry*)object;
|
||||
Skin *skin = *PLUGINOFFSET(Skin*, object, offset);
|
||||
if(skin == NULL)
|
||||
if(skin == nil)
|
||||
return -1;
|
||||
if(skin->platformData == NULL)
|
||||
if(skin->platformData == nil)
|
||||
return -1;
|
||||
NativeSkin *natskin = (NativeSkin*)skin->platformData;
|
||||
return 12 + 8 + 2*256*4 + 4*4 +
|
||||
|
@ -450,7 +450,7 @@ skinInstanceCB(Geometry *geo, InstanceDataHeader *header)
|
|||
defaultInstanceCB(geo, header);
|
||||
|
||||
Skin *skin = *PLUGINOFFSET(Skin*, geo, skinGlobals.offset);
|
||||
if(skin == NULL)
|
||||
if(skin == nil)
|
||||
return;
|
||||
NativeSkin *natskin = new NativeSkin;
|
||||
skin->platformData = natskin;
|
||||
|
@ -504,7 +504,7 @@ skinUninstanceCB(Geometry *geo, InstanceDataHeader *header)
|
|||
defaultUninstanceCB(geo, header);
|
||||
|
||||
Skin *skin = *PLUGINOFFSET(Skin*, geo, skinGlobals.offset);
|
||||
if(skin == NULL)
|
||||
if(skin == nil)
|
||||
return;
|
||||
NativeSkin *natskin = (NativeSkin*)skin->platformData;
|
||||
|
||||
|
@ -660,7 +660,7 @@ void
|
|||
registerVertexFormatPlugin(void)
|
||||
{
|
||||
vertexFmtOffset = Geometry::registerPlugin(sizeof(uint32), ID_VERTEXFMT,
|
||||
createVertexFmt, NULL, copyVertexFmt);
|
||||
createVertexFmt, nil, copyVertexFmt);
|
||||
Geometry::registerPluginStream(ID_VERTEXFMT,
|
||||
readVertexFmt,
|
||||
writeVertexFmt,
|
||||
|
@ -872,8 +872,8 @@ static void*
|
|||
createNativeRaster(void *object, int32 offset, int32)
|
||||
{
|
||||
XboxRaster *raster = PLUGINOFFSET(XboxRaster, object, offset);
|
||||
raster->texture = NULL;
|
||||
raster->palette = NULL;
|
||||
raster->texture = nil;
|
||||
raster->palette = nil;
|
||||
raster->format = 0;
|
||||
raster->hasAlpha = 0;
|
||||
raster->unknownFlag = 0;
|
||||
|
@ -891,8 +891,8 @@ static void*
|
|||
copyNativeRaster(void *dst, void *, int32 offset, int32)
|
||||
{
|
||||
XboxRaster *raster = PLUGINOFFSET(XboxRaster, dst, offset);
|
||||
raster->texture = NULL;
|
||||
raster->palette = NULL;
|
||||
raster->texture = nil;
|
||||
raster->palette = nil;
|
||||
raster->format = 0;
|
||||
raster->hasAlpha = 0;
|
||||
raster->unknownFlag = 0;
|
||||
|
@ -907,11 +907,11 @@ registerNativeRaster(void)
|
|||
createNativeRaster,
|
||||
destroyNativeRaster,
|
||||
copyNativeRaster);
|
||||
engine[PLATFORM_XBOX].rasterNativeOffset = nativeRasterOffset;
|
||||
engine[PLATFORM_XBOX].rasterCreate = rasterCreate;
|
||||
engine[PLATFORM_XBOX].rasterLock = rasterLock;
|
||||
engine[PLATFORM_XBOX].rasterUnlock = rasterUnlock;
|
||||
engine[PLATFORM_XBOX].rasterNumLevels = rasterNumLevels;
|
||||
driver[PLATFORM_XBOX].rasterNativeOffset = nativeRasterOffset;
|
||||
driver[PLATFORM_XBOX].rasterCreate = rasterCreate;
|
||||
driver[PLATFORM_XBOX].rasterLock = rasterLock;
|
||||
driver[PLATFORM_XBOX].rasterUnlock = rasterUnlock;
|
||||
driver[PLATFORM_XBOX].rasterNumLevels = rasterNumLevels;
|
||||
}
|
||||
|
||||
Texture*
|
||||
|
|
Loading…
Reference in New Issue