mirror of
https://github.com/aap/librw.git
synced 2024-11-28 14:45:41 +00:00
some texture fixes
This commit is contained in:
parent
a980b32e67
commit
2cd032a79e
@ -33,6 +33,8 @@ Engine::init(void)
|
||||
engine->currentCamera = nil;
|
||||
engine->currentWorld = nil;
|
||||
engine->currentTexDictionary = nil;
|
||||
engine->loadTextures = 1;
|
||||
engine->makeDummies = 1;
|
||||
|
||||
engine->beginUpdate = null::beginUpdate;
|
||||
engine->endUpdate = null::endUpdate;
|
||||
|
@ -635,8 +635,6 @@ Material::streamRead(Stream *stream)
|
||||
goto fail;
|
||||
}
|
||||
Texture *t = Texture::streamRead(stream);
|
||||
if(t == nil)
|
||||
goto fail;
|
||||
mat->setTexture(t);
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,8 @@ TexDictionary::create(void)
|
||||
void
|
||||
TexDictionary::destroy(void)
|
||||
{
|
||||
if(engine->currentTexDictionary == this)
|
||||
engine->currentTexDictionary = nil;
|
||||
FORLIST(lnk, this->textures)
|
||||
Texture::fromDict(lnk)->destroy();
|
||||
s_plglist.destruct(this);
|
||||
@ -54,13 +56,12 @@ TexDictionary::destroy(void)
|
||||
void
|
||||
TexDictionary::add(Texture *t)
|
||||
{
|
||||
if(engine->currentTexDictionary == this)
|
||||
engine->currentTexDictionary = nil;
|
||||
if(t->dict)
|
||||
t->inDict.remove();
|
||||
t->dict = this;
|
||||
this->textures.append(&t->inDict);
|
||||
}
|
||||
|
||||
Texture*
|
||||
TexDictionary::find(const char *name)
|
||||
{
|
||||
@ -152,8 +153,6 @@ TexDictionary::getCurrent(void)
|
||||
// Texture
|
||||
//
|
||||
|
||||
bool32 loadTextures;
|
||||
|
||||
static Texture *defaultFindCB(const char *name);
|
||||
static Texture *defaultReadCB(const char *name, const char *mask);
|
||||
|
||||
@ -234,12 +233,11 @@ Texture::read(const char *name, const char *mask)
|
||||
tex->refCount++;
|
||||
return tex;
|
||||
}
|
||||
if(loadTextures){
|
||||
if(engine->loadTextures){
|
||||
tex = Texture::readCB(name, mask);
|
||||
if(tex == nil)
|
||||
goto dummytex;
|
||||
}else{
|
||||
dummytex:
|
||||
}else dummytex: if(engine->makeDummies){
|
||||
tex = Texture::create(nil);
|
||||
if(tex == nil)
|
||||
return nil;
|
||||
@ -249,7 +247,7 @@ Texture::read(const char *name, const char *mask)
|
||||
raster = Raster::create(0, 0, 0, Raster::DONTALLOCATE);
|
||||
tex->raster = raster;
|
||||
}
|
||||
if(engine->currentTexDictionary){
|
||||
if(tex && engine->currentTexDictionary){
|
||||
if(tex->dict)
|
||||
tex->inDict.remove();
|
||||
engine->currentTexDictionary->add(tex);
|
||||
|
@ -50,7 +50,11 @@ struct Engine
|
||||
{
|
||||
void *currentCamera;
|
||||
void *currentWorld;
|
||||
|
||||
TexDictionary *currentTexDictionary;
|
||||
bool32 loadTextures; // load textures from files
|
||||
bool32 makeDummies; // create dummy textures to store just names
|
||||
|
||||
|
||||
// Device
|
||||
float32 zNear, zFar;
|
||||
|
@ -159,8 +159,10 @@ struct ObjectWithFrame
|
||||
if(this->object.parent)
|
||||
this->inFrame.remove();
|
||||
this->object.parent = f;
|
||||
if(f)
|
||||
if(f){
|
||||
f->objectList.add(&this->inFrame);
|
||||
f->updateObjects();
|
||||
}
|
||||
}
|
||||
void sync(void){ this->syncCB(this); }
|
||||
static ObjectWithFrame *fromFrame(LLLink *lnk){
|
||||
@ -258,8 +260,6 @@ struct Raster : PluginBase<Raster>
|
||||
};
|
||||
};
|
||||
|
||||
extern bool32 loadTextures;
|
||||
|
||||
#define IGNORERASTERIMP 0
|
||||
|
||||
struct TexDictionary;
|
||||
|
Loading…
Reference in New Issue
Block a user