Threw in texture loading/drawing.
Blending modes (color/texture) are problematic and texture coordinates aren't yet perfect.
This commit is contained in:
parent
efc384b7b3
commit
9dadcb8024
6 changed files with 184 additions and 82 deletions
15
src/main.c
15
src/main.c
|
@ -70,6 +70,7 @@ int InitialiseWindowsSystem()
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +357,7 @@ void ThisFramesRenderingHasBegun()
|
||||||
|
|
||||||
/* TODO: this should be in D3D_DrawBackdrop */
|
/* TODO: this should be in D3D_DrawBackdrop */
|
||||||
#if 1
|
#if 1
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,10 +436,16 @@ int main(int argc, char *argv[])
|
||||||
AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */
|
AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */
|
||||||
|
|
||||||
// AvP.PlayerType = I_Alien;
|
// AvP.PlayerType = I_Alien;
|
||||||
AvP.PlayerType = I_Marine;
|
|
||||||
|
// AvP.PlayerType = I_Marine;
|
||||||
|
// SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
|
||||||
// SetLevelToLoad(AVP_ENVIRONMENT_INVASION); /* because the menus aren't implemented */
|
// SetLevelToLoad(AVP_ENVIRONMENT_INVASION); /* because the menus aren't implemented */
|
||||||
SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
|
|
||||||
// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP);
|
|
||||||
|
AvP.PlayerType = I_Predator;
|
||||||
|
SetLevelToLoad(AVP_ENVIRONMENT_WATERFALL);
|
||||||
|
|
||||||
|
// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer
|
||||||
|
|
||||||
// while(AvP_MainMenus()) {
|
// while(AvP_MainMenus()) {
|
||||||
|
|
||||||
|
|
64
src/opengl.c
64
src/opengl.c
|
@ -19,6 +19,7 @@
|
||||||
#include "prototyp.h"
|
#include "prototyp.h"
|
||||||
#include "d3d_hud.h"
|
#include "d3d_hud.h"
|
||||||
#include "avp_userprofile.h"
|
#include "avp_userprofile.h"
|
||||||
|
#include "aw.h"
|
||||||
|
|
||||||
|
|
||||||
extern IMAGEHEADER ImageHeaderArray[];
|
extern IMAGEHEADER ImageHeaderArray[];
|
||||||
|
@ -27,7 +28,38 @@ extern unsigned char GammaValues[256];
|
||||||
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
|
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
|
||||||
extern int SpecialFXImageNumber;
|
extern int SpecialFXImageNumber;
|
||||||
|
|
||||||
static void *CurrTextureHandle;
|
static D3DTexture *CurrTextureHandle;
|
||||||
|
|
||||||
|
void FlushD3DZBuffer()
|
||||||
|
{
|
||||||
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecondFlushD3DZBuffer()
|
||||||
|
{
|
||||||
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLuint CreateOGLTexture(D3DTexture *tex, unsigned char *buf)
|
||||||
|
{
|
||||||
|
GLuint h;
|
||||||
|
|
||||||
|
glGenTextures(1, &h);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, h);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex->w, tex->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||||
|
|
||||||
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
|
tex->id = h;
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
#define TRANSLUCENCY_ONEONE 33
|
#define TRANSLUCENCY_ONEONE 33
|
||||||
void CheckTranslucencyModeIsCorrect(int mode) /* TODO: use correct enum */
|
void CheckTranslucencyModeIsCorrect(int mode) /* TODO: use correct enum */
|
||||||
|
@ -66,17 +98,20 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
int texoffset;
|
int texoffset;
|
||||||
void *TextureHandle;
|
D3DTexture *TextureHandle;
|
||||||
int i;
|
int i;
|
||||||
GLfloat ZNear, zvalue;
|
GLfloat ZNear, zvalue;
|
||||||
// GLflaot ZFar;
|
// GLfloat ZFar;
|
||||||
|
float RecipW, RecipH;
|
||||||
|
|
||||||
|
// glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
ZNear = (GLfloat) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
|
ZNear = (GLfloat) (Global_VDB_Ptr->VDB_ClipZ * GlobalScale);
|
||||||
// ZFar = 18000.0f; /* TODO: is this good enough? */
|
// ZFar = 18000.0f; /* TODO: is this good enough? */
|
||||||
|
|
||||||
texoffset = inputPolyPtr->PolyColour & ClrTxDefn;
|
texoffset = inputPolyPtr->PolyColour & ClrTxDefn;
|
||||||
if (texoffset) {
|
if (texoffset) {
|
||||||
TextureHandle = (void *)ImageHeaderArray[texoffset].D3DHandle;
|
TextureHandle = (void *)ImageHeaderArray[texoffset].D3DTexture;
|
||||||
} else {
|
} else {
|
||||||
TextureHandle = CurrTextureHandle;
|
TextureHandle = CurrTextureHandle;
|
||||||
}
|
}
|
||||||
|
@ -91,12 +126,23 @@ void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr, RENDER
|
||||||
if (SecondaryColorExt)
|
if (SecondaryColorExt)
|
||||||
glEnable(GL_COLOR_SUM_EXT);
|
glEnable(GL_COLOR_SUM_EXT);
|
||||||
*/
|
*/
|
||||||
|
RecipW = (1.0f/65536.0f)/128.0f;
|
||||||
|
RecipH = (1.0f/65536.0f)/128.0f;
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, TextureHandle->id);
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||||
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
RENDERVERTEX *vertices = &renderVerticesPtr[i];
|
||||||
GLfloat x, y, z;
|
GLfloat x, y, z;
|
||||||
int x1, y1;
|
int x1, y1;
|
||||||
|
GLfloat s, t;
|
||||||
|
|
||||||
|
/* this currently doesn't work quite right */
|
||||||
|
s = ((float)vertices->U) * RecipW + (1.0f/256.0f);
|
||||||
|
t = ((float)vertices->V) * RecipH + (1.0f/256.0f);
|
||||||
|
z = (65536.0f)/(vertices->Z);
|
||||||
|
glTexCoord4f(s, t, 0, 1.00);
|
||||||
|
|
||||||
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
x1 = (vertices->X*(Global_VDB_Ptr->VDB_ProjX+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreX;
|
||||||
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
y1 = (vertices->Y*(Global_VDB_Ptr->VDB_ProjY+1))/vertices->Z+Global_VDB_Ptr->VDB_CentreY;
|
||||||
|
@ -133,6 +179,7 @@ return;
|
||||||
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_ONEONE);
|
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_ONEONE);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
for (i = 0; i < RenderPolygon.NumberOfVertices; i++) {
|
||||||
|
@ -145,20 +192,23 @@ return;
|
||||||
x = x1;
|
x = x1;
|
||||||
y = y1;
|
y = y1;
|
||||||
|
|
||||||
x = (x - 320.0)/320.0;
|
// x = (x - 320.0)/320.0;
|
||||||
y = -(y - 240.0)/240.0;
|
// y = -(y - 240.0)/240.0;
|
||||||
|
x = (x - ScreenDescriptorBlock.SDB_CentreX)/ScreenDescriptorBlock.SDB_CentreX;
|
||||||
|
y = -(y - ScreenDescriptorBlock.SDB_CentreY)/ScreenDescriptorBlock.SDB_CentreY;
|
||||||
|
|
||||||
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
zvalue = vertices->Z+HeadUpDisplayZOffset;
|
||||||
zvalue = 1.0 - 2*ZNear/zvalue; /* currently maps [ZNear, inf) to [-1, 1], probably could be more precise with a ZFar */
|
zvalue = 1.0 - 2*ZNear/zvalue; /* currently maps [ZNear, inf) to [-1, 1], probably could be more precise with a ZFar */
|
||||||
z = zvalue;
|
z = zvalue;
|
||||||
|
|
||||||
glColor4ub(GammaValues[vertices->SpecularR], GammaValues[vertices->SpecularG], GammaValues[vertices->SpecularB], 255);
|
glColor4b(GammaValues[vertices->SpecularR], GammaValues[vertices->SpecularG], GammaValues[vertices->SpecularB], 255);
|
||||||
glVertex3f(x, y, z);
|
glVertex3f(x, y, z);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
20
src/stubs.c
20
src/stubs.c
|
@ -441,6 +441,8 @@ void SetFogDistance(int fogDistance)
|
||||||
|
|
||||||
void CheckWireFrameMode(int shouldBeOn)
|
void CheckWireFrameMode(int shouldBeOn)
|
||||||
{
|
{
|
||||||
|
// fprintf(stderr, "CheckWireFrameMode(%d)\n", shouldBeOn);
|
||||||
|
if (shouldBeOn)
|
||||||
fprintf(stderr, "CheckWireFrameMode(%d)\n", shouldBeOn);
|
fprintf(stderr, "CheckWireFrameMode(%d)\n", shouldBeOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,11 +458,6 @@ BOOL UnlockExecuteBufferAndPrepareForUse()
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SecondFlushD3DZBuffer()
|
|
||||||
{
|
|
||||||
fprintf(stderr, "SecondFlushD3DZBuffer()\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReloadImageIntoD3DImmediateSurface(IMAGEHEADER* iheader)
|
void ReloadImageIntoD3DImmediateSurface(IMAGEHEADER* iheader)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ReloadImageIntoD3DImmediateSurface(%p)\n", iheader);
|
fprintf(stderr, "ReloadImageIntoD3DImmediateSurface(%p)\n", iheader);
|
||||||
|
@ -486,14 +483,9 @@ void ReleaseD3DTexture(void* D3DTexture)
|
||||||
fprintf(stderr, "ReleaseD3DTexture(%p)\n", D3DTexture);
|
fprintf(stderr, "ReleaseD3DTexture(%p)\n", D3DTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlushD3DZBuffer()
|
|
||||||
{
|
|
||||||
fprintf(stderr, "FlushD3DZBuffer()\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL ExecuteBuffer()
|
BOOL ExecuteBuffer()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ExecuteBuffer()\n");
|
// fprintf(stderr, "ExecuteBuffer()\n");
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -671,17 +663,17 @@ int MouseVelY;
|
||||||
|
|
||||||
void DirectReadKeyboard()
|
void DirectReadKeyboard()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DirectReadKeyboard()\n");
|
// fprintf(stderr, "DirectReadKeyboard()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectReadMouse()
|
void DirectReadMouse()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DirectReadMouse()\n");
|
// fprintf(stderr, "DirectReadMouse()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadJoysticks()
|
void ReadJoysticks()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ReadJoysticks()\n");
|
// fprintf(stderr, "ReadJoysticks()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ typedef struct DIRECTDRAWSURFACE
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
int type;
|
|
||||||
} DIRECTDRAWSURFACE;
|
} DIRECTDRAWSURFACE;
|
||||||
|
|
||||||
typedef DIRECTDRAWSURFACE * LPDIRECTDRAWSURFACE;
|
typedef DIRECTDRAWSURFACE * LPDIRECTDRAWSURFACE;
|
||||||
|
@ -24,7 +23,6 @@ typedef struct DIRECT3DTEXTURE
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
int type;
|
|
||||||
} DIRECT3DTEXTURE;
|
} DIRECT3DTEXTURE;
|
||||||
|
|
||||||
typedef DIRECT3DTEXTURE * LPDIRECT3DTEXTURE;
|
typedef DIRECT3DTEXTURE * LPDIRECT3DTEXTURE;
|
||||||
|
|
|
@ -416,8 +416,8 @@ DWORD AwBackupTexture::GetTransparentColour()
|
||||||
|
|
||||||
void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR)
|
void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "AwBackupTexture::ChoosePixelFormat(...)\n");
|
// fprintf(stderr, "AwBackupTexture::ChoosePixelFormat(...)\n");
|
||||||
#if 0
|
|
||||||
using namespace AwTl;
|
using namespace AwTl;
|
||||||
|
|
||||||
pixelFormat.validB = false; // set invalid first
|
pixelFormat.validB = false; // set invalid first
|
||||||
|
@ -432,25 +432,16 @@ void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR
|
||||||
// transparency?
|
// transparency?
|
||||||
m_bTranspMask = HasTransparentMask(fMyFlags & AW_TLF_TRANSP ? true : false);
|
m_bTranspMask = HasTransparentMask(fMyFlags & AW_TLF_TRANSP ? true : false);
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (_parmsR.prevTexP.voidP)
|
|
||||||
{
|
|
||||||
// use the previous format
|
|
||||||
}
|
|
||||||
else if (_parmsR.prevTexB)
|
|
||||||
{
|
|
||||||
// use the previous format from one of the regiouns
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_parmsR.loadTextureB || fMyFlags & AW_TLF_TEXTURE)
|
if (_parmsR.loadTextureB || fMyFlags & AW_TLF_TEXTURE)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "AwBackupTexture::ChoosePixelFormat(...)\n");
|
||||||
|
#if 0
|
||||||
// use a texture format
|
// use a texture format
|
||||||
unsigned nColours = GetNumColours();
|
unsigned nColours = GetNumColours();
|
||||||
unsigned nMinPalSize = GetMinPaletteSize();
|
unsigned nMinPalSize = GetMinPaletteSize();
|
||||||
|
|
||||||
PixelFormat const * pFormat = &pfTextureFormat;
|
PixelFormat * pFormat = &pfTextureFormat;
|
||||||
|
|
||||||
for (LIF<AdditionalPixelFormat> itFormat(&listTextureFormats); !itFormat.done(); itFormat.next())
|
for (LIF<AdditionalPixelFormat> itFormat(&listTextureFormats); !itFormat.done(); itFormat.next())
|
||||||
{
|
{
|
||||||
|
@ -480,7 +471,7 @@ void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR
|
||||||
if (pixelFormat.alphaB)
|
if (pixelFormat.alphaB)
|
||||||
{
|
{
|
||||||
unsigned alpha_l_shft,alpha_r_shft;
|
unsigned alpha_l_shft,alpha_r_shft;
|
||||||
SetBitShifts(&alpha_l_shft,&alpha_r_shft,pixelFormat.ddpf.dwRGBAlphaBitMask);
|
SetBitShifts(&alpha_l_shft,&alpha_r_shft,pixelFormat.dwRGBAlphaBitMask);
|
||||||
|
|
||||||
db_logf4(("\tchosen %u-bit %u%u%u%u texture format",
|
db_logf4(("\tchosen %u-bit %u%u%u%u texture format",
|
||||||
pixelFormat.bitsPerPixel,
|
pixelFormat.bitsPerPixel,
|
||||||
|
@ -504,19 +495,89 @@ void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR
|
||||||
{
|
{
|
||||||
// use display surface format
|
// use display surface format
|
||||||
pixelFormat = pfSurfaceFormat;
|
pixelFormat = pfSurfaceFormat;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Just convert the texture to 32bpp */
|
||||||
|
pixelFormat.palettizedB = 0;
|
||||||
|
pixelFormat.alphaB = 0;
|
||||||
|
pixelFormat.validB = 1;
|
||||||
|
pixelFormat.bitsPerPixel = 32;
|
||||||
|
pixelFormat.redLeftShift = 0;
|
||||||
|
pixelFormat.greenLeftShift = 8;
|
||||||
|
pixelFormat.blueLeftShift = 16;
|
||||||
|
pixelFormat.redRightShift = 0;
|
||||||
|
pixelFormat.greenRightShift = 0;
|
||||||
|
pixelFormat.blueRightShift = 0;
|
||||||
|
pixelFormat.dwRGBAlphaBitMask = 0x00000000;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern int CreateOGLTexture(D3DTexture *, unsigned char *);
|
||||||
|
};
|
||||||
|
|
||||||
AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & _parmsR)
|
AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & _parmsR)
|
||||||
{
|
{
|
||||||
using namespace AwTl;
|
using namespace AwTl;
|
||||||
|
|
||||||
fprintf(stderr, "AwBackupTexture::CreateTexture(...) This is where we could convert the image to RGB/RGBA, and so on\n");
|
// fprintf(stderr, "AwBackupTexture::CreateTexture(...) This is where we could convert the image to RGB/RGBA, and so on\n");
|
||||||
|
|
||||||
SurfUnion pRet = static_cast<D3DTexture *>(new D3DTexture);
|
D3DTexture *Tex = new D3DTexture;
|
||||||
|
|
||||||
return pRet;
|
unsigned char *buf = (unsigned char *)malloc(m_nWidth * m_nHeight * 4);
|
||||||
|
|
||||||
|
Colour * paletteP = m_nPaletteSize ? GetPalette() : NULL;
|
||||||
|
|
||||||
|
unsigned y = 0;
|
||||||
|
bool reversed_rowsB = AreRowsReversed();
|
||||||
|
if (reversed_rowsB)
|
||||||
|
{
|
||||||
|
y = m_nHeight-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i, rowcount = m_nHeight; rowcount; --rowcount, i++)
|
||||||
|
{
|
||||||
|
PtrUnion src_rowP = GetRowPtr(y);
|
||||||
|
db_assert1(src_rowP.voidP);
|
||||||
|
|
||||||
|
// allow loading of the next row from the file
|
||||||
|
LoadNextRow(src_rowP);
|
||||||
|
|
||||||
|
// loop for copying data to surfaces
|
||||||
|
{
|
||||||
|
|
||||||
|
{
|
||||||
|
// are we in the vertical range of this surface?
|
||||||
|
{
|
||||||
|
|
||||||
|
// convert and copy the section of the row to the direct draw surface
|
||||||
|
// ConvertRow(pLoadInfo->surface_dataP,pLoadInfo->surface_width,src_rowP,pLoadInfo->left,pLoadInfo->width,paletteP db_code1(DB_COMMA m_nPaletteSize));
|
||||||
|
|
||||||
|
PtrUnion my_data = &buf[y*m_nWidth*4];
|
||||||
|
|
||||||
|
ConvertRow(my_data,m_nWidth,src_rowP,0,m_nWidth,paletteP db_code1(DB_COMMA m_nPaletteSize));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// next row
|
||||||
|
if (reversed_rowsB)
|
||||||
|
--y;
|
||||||
|
else
|
||||||
|
++y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* temp junk */
|
||||||
|
Tex->w = m_nWidth;
|
||||||
|
Tex->h = m_nHeight;
|
||||||
|
Tex->data = NULL;
|
||||||
|
CreateOGLTexture(Tex, buf); /* this will set the id */
|
||||||
|
free(buf);
|
||||||
|
|
||||||
|
return static_cast<SurfUnion>(Tex);
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
// which flags to use?
|
// which flags to use?
|
||||||
|
@ -1394,9 +1455,8 @@ namespace AwTl {
|
||||||
// CHECK_MEDIA_ERRORS("loading file headers")
|
// CHECK_MEDIA_ERRORS("loading file headers")
|
||||||
ON_ERROR_RETURN_NULL("loading file headers")
|
ON_ERROR_RETURN_NULL("loading file headers")
|
||||||
|
|
||||||
#if 0
|
|
||||||
ChoosePixelFormat(rParams);
|
ChoosePixelFormat(rParams);
|
||||||
|
#if 0
|
||||||
if (!pixelFormat.validB)
|
if (!pixelFormat.validB)
|
||||||
db_log3("AwCreateGraphic(): ERROR: pixel format not valid");
|
db_log3("AwCreateGraphic(): ERROR: pixel format not valid");
|
||||||
if (!driverDesc.ddP || !driverDesc.validB && rParams.loadTextureB)
|
if (!driverDesc.ddP || !driverDesc.validB && rParams.loadTextureB)
|
||||||
|
@ -1406,7 +1466,7 @@ namespace AwTl {
|
||||||
|
|
||||||
ON_ERROR_RETURN_NULL("initializing load")
|
ON_ERROR_RETURN_NULL("initializing load")
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "TexFileLoader::Load Pixel Format?! It's not implemented!\n");
|
// fprintf(stderr, "TexFileLoader::Load Pixel Format?! It's not implemented!\n");
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
AllocateBuffers(/* rParams.backupHP ? true : */ false, /* pixelFormat.palettizedB ? ? 1<<pixelFormat.bitsPerPixel : */ 0);
|
AllocateBuffers(/* rParams.backupHP ? true : */ false, /* pixelFormat.palettizedB ? ? 1<<pixelFormat.bitsPerPixel : */ 0);
|
||||||
|
@ -1602,25 +1662,6 @@ namespace AwTl {
|
||||||
{
|
{
|
||||||
static MagicFileIdTree mfidt;
|
static MagicFileIdTree mfidt;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
// Touch the loaders.
|
|
||||||
{
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rlcAwBmpLoader_187);
|
|
||||||
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rlcAwIffLoader_428);
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rlcAwIffLoader_429);
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rlcAwIffLoader_430);
|
|
||||||
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rlcAwPpmLoader_229);
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rlcAwPgmLoader_230);
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rlcAwPbmLoader_231);
|
|
||||||
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rccIlbmBmhdChunk_4);
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rccIlbmCmapChunk_5);
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rccIlbmBodyChunk_6);
|
|
||||||
mfidt.hack += reinterpret_cast<unsigned>(&rccIlbmGrabChunk_7);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
g_pMagicFileIdTree = &mfidt;
|
g_pMagicFileIdTree = &mfidt;
|
||||||
|
|
||||||
MagicFileIdTree * pLayer = g_pMagicFileIdTree;
|
MagicFileIdTree * pLayer = g_pMagicFileIdTree;
|
||||||
|
@ -2014,6 +2055,19 @@ fprintf(stderr, "AwSetPixelFormat(%p, %p)\n", _pfP, _ddpfP);
|
||||||
_pfP->palettizedB = true;
|
_pfP->palettizedB = true;
|
||||||
|
|
||||||
_pfP->validB = true;
|
_pfP->validB = true;
|
||||||
|
|
||||||
|
_pfP->palettizedB = 0;
|
||||||
|
_pfP->alphaB = 0;
|
||||||
|
_pfP->validB = 1;
|
||||||
|
_pfP->bitsPerPixel = 32;
|
||||||
|
_pfP->redLeftShift = 0;
|
||||||
|
_pfP->greenLeftShift = 8;
|
||||||
|
_pfP->blueLeftShift = 16;
|
||||||
|
_pfP->redRightShift = 0;
|
||||||
|
_pfP->greenRightShift = 0;
|
||||||
|
_pfP->blueRightShift = 0;
|
||||||
|
_pfP->dwRGBAlphaBitMask = 0xFF000000;
|
||||||
|
|
||||||
return AW_TLE_OK;
|
return AW_TLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,13 @@ namespace AwTl {
|
||||||
unsigned blueLeftShift;
|
unsigned blueLeftShift;
|
||||||
unsigned blueRightShift;
|
unsigned blueRightShift;
|
||||||
|
|
||||||
|
unsigned dwRGBAlphaBitMask;
|
||||||
// DDPIXELFORMAT ddpf;
|
// DDPIXELFORMAT ddpf;
|
||||||
};
|
};
|
||||||
|
|
||||||
// DO SOMTHING ABOUT THIS
|
// DO SOMTHING ABOUT THIS
|
||||||
extern PixelFormat pixelFormat;
|
extern PixelFormat pixelFormat;
|
||||||
|
extern PixelFormat pfSurfaceFormat;
|
||||||
|
|
||||||
class CreateTextureParms;
|
class CreateTextureParms;
|
||||||
|
|
||||||
|
@ -57,9 +59,7 @@ namespace AwTl {
|
||||||
static_cast<unsigned>(_colP->r)>>pixelFormat.redRightShift<<pixelFormat.redLeftShift
|
static_cast<unsigned>(_colP->r)>>pixelFormat.redRightShift<<pixelFormat.redLeftShift
|
||||||
|static_cast<unsigned>(_colP->g)>>pixelFormat.greenRightShift<<pixelFormat.greenLeftShift
|
|static_cast<unsigned>(_colP->g)>>pixelFormat.greenRightShift<<pixelFormat.greenLeftShift
|
||||||
|static_cast<unsigned>(_colP->b)>>pixelFormat.blueRightShift<<pixelFormat.blueLeftShift
|
|static_cast<unsigned>(_colP->b)>>pixelFormat.blueRightShift<<pixelFormat.blueLeftShift
|
||||||
/* TODO */
|
|pixelFormat.dwRGBAlphaBitMask;
|
||||||
/*|pixelFormat.ddpf.dwRGBAlphaBitMask*/
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
static inline unsigned DoConv(BYTE const * _colP, Colour const * _paletteP db_code1(DB_COMMA unsigned _paletteSize))
|
static inline unsigned DoConv(BYTE const * _colP, Colour const * _paletteP db_code1(DB_COMMA unsigned _paletteSize))
|
||||||
{
|
{
|
||||||
|
@ -224,6 +224,7 @@ namespace AwTl {
|
||||||
*_dstRowP.byteP++ = u.b[1];
|
*_dstRowP.byteP++ = u.b[1];
|
||||||
*_dstRowP.byteP = u.b[2];
|
*_dstRowP.byteP = u.b[2];
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue