mirror of
https://github.com/aap/librw.git
synced 2025-12-19 08:59:51 +00:00
implemented generic lighting callback
This commit is contained in:
@@ -111,6 +111,19 @@ initFont(void)
|
||||
{
|
||||
vga.tex = Texture::read("Bm437_IBM_VGA8", "");
|
||||
bios.tex = Texture::read("Bm437_IBM_BIOS", "");
|
||||
|
||||
/*
|
||||
FILE *foo = fopen("font.c", "w");
|
||||
assert(foo);
|
||||
int x, y;
|
||||
rw::Image *img = rw::readTGA("vga_font.tga");
|
||||
assert(img);
|
||||
for(y = 0; y < img->height; y++){
|
||||
for(x = 0; x < img->width; x++)
|
||||
fprintf(foo, "%d, ", !!img->pixels[y*img->width + x]);
|
||||
fprintf(foo, "\n");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -27,6 +27,8 @@ void genIm3DEnd(void);
|
||||
void initFont(void);
|
||||
void printScreen(const char *s, float x, float y);
|
||||
|
||||
rw::Charset *testfont;
|
||||
|
||||
//#include <Windows.h>
|
||||
|
||||
void
|
||||
@@ -177,9 +179,18 @@ InitRW(void)
|
||||
if(!sk::InitRW())
|
||||
return false;
|
||||
|
||||
rw::d3d::isP8supported = false;
|
||||
|
||||
initFont();
|
||||
|
||||
rw::d3d::isP8supported = false;
|
||||
rw::RGBA foreground = { 255, 255, 0, 255 };
|
||||
rw::RGBA background = { 0, 0, 0, 0 };
|
||||
rw::Charset::open();
|
||||
testfont = rw::Charset::create(&foreground, &background);
|
||||
assert(testfont);
|
||||
foreground.blue = 255.0f;
|
||||
testfont->setColors(&foreground, &background);
|
||||
|
||||
tex = rw::Texture::read("maze", nil);
|
||||
tex2 = rw::Texture::read("checkers", nil);
|
||||
|
||||
@@ -327,7 +338,8 @@ im3dtest(void)
|
||||
verts[i].setV(vs[i].v);
|
||||
}
|
||||
|
||||
rw::SetRenderStatePtr(rw::TEXTURERASTER, tex->raster);
|
||||
// rw::SetRenderStatePtr(rw::TEXTURERASTER, tex->raster);
|
||||
rw::SetRenderStatePtr(rw::TEXTURERASTER, testfont->raster);
|
||||
// rw::SetRenderStatePtr(rw::TEXTURERASTER, frontbuffer->raster);
|
||||
rw::SetRenderState(rw::TEXTUREADDRESS, rw::Texture::WRAP);
|
||||
rw::SetRenderState(rw::TEXTUREFILTER, rw::Texture::NEAREST);
|
||||
@@ -392,6 +404,7 @@ extern void endSoftras(void);
|
||||
im3dtest();
|
||||
// printScreen("Hello, World!", 10, 10);
|
||||
|
||||
testfont->print("foo ABC", 200, 200, true);
|
||||
|
||||
camera->m_rwcam->endUpdate();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ enumLights(Matrix *lightmat)
|
||||
ambLight.alpha = 0.0;
|
||||
numDirectionals = 0;
|
||||
// only unpositioned lights right now
|
||||
FORLIST(lnk, world->directionalLights){
|
||||
FORLIST(lnk, world->globalLights){
|
||||
Light *l = Light::fromWorld(lnk);
|
||||
if(l->getType() == Light::DIRECTIONAL){
|
||||
if(numDirectionals >= MAX_LIGHTS)
|
||||
|
||||
Reference in New Issue
Block a user