build on windows

This commit is contained in:
David Rose 2008-05-06 19:18:41 +00:00
parent 846c2a9fcc
commit 80253733c6
29 changed files with 110 additions and 141 deletions

View File

@ -1,5 +1,5 @@
#define BUILD_DIRECTORY $[HAVE_SDL]
//#define BUILDING_DLL BUILDING_TINYDISPLAY
#define BUILDING_DLL BUILDING_TINYDISPLAY
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
dtoolutil:c dtoolbase:c dtool:m
@ -21,13 +21,13 @@
tinyTextureContext.I tinyTextureContext.cxx tinyTextureContext.h \
tinyXGraphicsPipe.I tinyXGraphicsPipe.cxx tinyXGraphicsPipe.h \
tinyXGraphicsWindow.h tinyXGraphicsWindow.I tinyXGraphicsWindow.cxx \
clip.c error.c \
image_util.c init.c light.c \
memory.c msghandling.c msghandling.h \
specbuf.c \
texture.c vertex.c \
zbuffer.c zbuffer.h zdither.c zfeatures.h zgl.h zline.c \
zline.h zmath.c zmath.h ztriangle.c ztriangle.h ztriangle_two.h
clip.cxx error.cxx \
image_util.cxx init.cxx light.cxx \
memory.cxx msghandling.cxx msghandling.h \
specbuf.cxx \
texture.cxx vertex.cxx \
zbuffer.cxx zbuffer.h zdither.cxx zfeatures.h zgl.h zline.cxx \
zline.h zmath.cxx zmath.h ztriangle.cxx ztriangle.h ztriangle_two.h
#end lib_target

View File

@ -15,7 +15,7 @@ void gl_transform_to_viewport(GLContext *c,GLVertex *v)
float winv;
/* coordinates */
winv=1.0/v->pc.W;
winv = 1.0f / v->pc.W;
v->zp.x= (int) ( v->pc.X * winv * c->viewport.scale.X
+ c->viewport.trans.X );
v->zp.y= (int) ( v->pc.Y * winv * c->viewport.scale.Y

View File

@ -25,9 +25,9 @@
#include "configVariableBool.h"
#include "configVariableInt.h"
NotifyCategoryDecl(tinydisplay, EXPCL_PANDAGL, EXPTP_PANDAGL);
NotifyCategoryDecl(tinydisplay, EXPCL_TINYDISPLAY, EXPTP_TINYDISPLAY);
extern EXPCL_PANDAGL void init_libtinydisplay();
extern EXPCL_TINYDISPLAY void init_libtinydisplay();
extern ConfigVariableString display_cfg;
extern ConfigVariableBool x_error_abort;

View File

@ -19,7 +19,7 @@ void glInit(GLContext *c, ZBuffer *zbuffer)
/* lights */
c->first_light=NULL;
c->ambient_light_model=gl_V4_New(0.2,0.2,0.2,1);
c->ambient_light_model=gl_V4_New(0.2f, 0.2f, 0.2f, 1.0f);
c->local_light_model=0;
c->lighting_enabled=0;
c->light_model_two_side = 0;
@ -27,28 +27,28 @@ void glInit(GLContext *c, ZBuffer *zbuffer)
/* default materials */
for(i=0;i<2;i++) {
GLMaterial *m=&c->materials[i];
m->emission=gl_V4_New(0,0,0,1);
m->ambient=gl_V4_New(0.2,0.2,0.2,1);
m->diffuse=gl_V4_New(0.8,0.8,0.8,1);
m->specular=gl_V4_New(0,0,0,1);
m->emission=gl_V4_New(0.0f, 0.0f, 0.0f, 1.0f);
m->ambient=gl_V4_New(0.2f, 0.2f, 0.2f, 1.0f);
m->diffuse=gl_V4_New(0.8f, 0.8f, 0.8f, 1.0f);
m->specular=gl_V4_New(0.0f, 0.0f, 0.0f, 1.0f);
m->shininess=0;
}
/* default state */
c->current_color.X=1.0;
c->current_color.Y=1.0;
c->current_color.Z=1.0;
c->current_color.W=1.0;
c->current_color.X=1.0f;
c->current_color.Y=1.0f;
c->current_color.Z=1.0f;
c->current_color.W=1.0f;
c->current_normal.X=1.0;
c->current_normal.Y=0.0;
c->current_normal.Z=0.0;
c->current_normal.W=0.0;
c->current_normal.X=1.0f;
c->current_normal.Y=0.0f;
c->current_normal.Z=0.0f;
c->current_normal.W=0.0f;
c->current_tex_coord.X=0;
c->current_tex_coord.Y=0;
c->current_tex_coord.Z=0;
c->current_tex_coord.W=1;
c->current_tex_coord.X=0.0f;
c->current_tex_coord.Y=0.0f;
c->current_tex_coord.Z=0.0f;
c->current_tex_coord.W=1.0f;
c->cull_face_enabled=0;

View File

@ -1,5 +1,6 @@
#include "zgl.h"
#include "msghandling.h"
#include <math.h>
static inline float clampf(float a,float min,float max)
{
@ -48,7 +49,7 @@ void gl_shade_vertex(GLContext *c,GLVertex *v)
d.X=l->position.v[0]-v->ec.v[0];
d.Y=l->position.v[1]-v->ec.v[1];
d.Z=l->position.v[2]-v->ec.v[2];
dist=sqrt(d.X*d.X+d.Y*d.Y+d.Z*d.Z);
dist = sqrtf(d.X*d.X+d.Y*d.Y+d.Z*d.Z);
if (dist>1E-3) {
tmp=1/dist;
d.X*=tmp;
@ -97,7 +98,7 @@ void gl_shade_vertex(GLContext *c,GLVertex *v)
} else {
s.X=d.X;
s.Y=d.Y;
s.Z=d.Z+1.0;
s.Z=d.Z+1.0f;
}
dot_spec=n.X*s.X+n.Y*s.Y+n.Z*s.Z;
if (twoside && dot_spec < 0) dot_spec = -dot_spec;

View File

@ -33,7 +33,7 @@ specbuf_get_buffer(GLContext *c, const int shininess_i,
}
if (oldest == NULL || c->specbuf_num_buffers < MAX_SPECULAR_BUFFERS) {
/* create new buffer */
GLSpecBuf *buf = gl_malloc(sizeof(GLSpecBuf));
GLSpecBuf *buf = (GLSpecBuf *)gl_malloc(sizeof(GLSpecBuf));
if (!buf) gl_fatal_error("could not allocate specular buffer");
c->specbuf_num_buffers++;
buf->next = c->specbuf_first;

View File

@ -30,7 +30,7 @@
// for TinyGL rendering. In particular, it makes sure
// colors aren't stored in DirectX's packed_argb format.
////////////////////////////////////////////////////////////////////
class TinyGeomMunger : public StandardMunger {
class EXPCL_TINYDISPLAY TinyGeomMunger : public StandardMunger {
public:
TinyGeomMunger(GraphicsStateGuardian *gsg, const RenderState *state);
virtual ~TinyGeomMunger();

View File

@ -27,11 +27,8 @@
#include "directionalLight.h"
#include "spotlight.h"
#include "bitMask.h"
extern "C" {
#include "zgl.h"
#include "zmath.h"
}
TypeHandle TinyGraphicsStateGuardian::_type_handle;

View File

@ -24,11 +24,8 @@
#include "graphicsStateGuardian.h"
#include "tinySDLGraphicsPipe.h"
#include "simpleLru.h"
extern "C" {
#include "zmath.h"
#include "zbuffer.h"
}
#include "zmath.h"
#include "zbuffer.h"
class TinyTextureContext;
struct GLContext;
@ -41,7 +38,7 @@ struct GLTexture;
// Description : An interface to the TinyGL software rendering code
// within this module.
////////////////////////////////////////////////////////////////////
class TinyGraphicsStateGuardian : public GraphicsStateGuardian {
class EXPCL_TINYDISPLAY TinyGraphicsStateGuardian : public GraphicsStateGuardian {
public:
TinyGraphicsStateGuardian(GraphicsPipe *pipe,
TinyGraphicsStateGuardian *share_with);

View File

@ -30,7 +30,7 @@ class FrameBufferProperties;
// Description : This graphics pipe manages SDL windows for rendering
// TinyGL software buffers.
////////////////////////////////////////////////////////////////////
class TinySDLGraphicsPipe : public GraphicsPipe {
class EXPCL_TINYDISPLAY TinySDLGraphicsPipe : public GraphicsPipe {
public:
TinySDLGraphicsPipe();
virtual ~TinySDLGraphicsPipe();

View File

@ -24,17 +24,14 @@
#include "tinySDLGraphicsPipe.h"
#include "graphicsWindow.h"
#include "buttonHandle.h"
extern "C" {
#include "SDL.h"
#include "zbuffer.h"
}
#include "SDL.h"
#include "zbuffer.h"
////////////////////////////////////////////////////////////////////
// Class : TinySDLGraphicsWindow
// Description : This graphics window class is implemented via SDL.
////////////////////////////////////////////////////////////////////
class TinySDLGraphicsWindow : public GraphicsWindow {
class EXPCL_TINYDISPLAY TinySDLGraphicsWindow : public GraphicsWindow {
public:
TinySDLGraphicsWindow(GraphicsPipe *pipe,
const string &name,

View File

@ -17,10 +17,7 @@
////////////////////////////////////////////////////////////////////
#include "tinyTextureContext.h"
extern "C" {
#include "zgl.h"
}
TypeHandle TinyTextureContext::_type_handle;

View File

@ -30,7 +30,7 @@ struct GLTexture;
// Class : TinyTextureContext
// Description :
////////////////////////////////////////////////////////////////////
class TinyTextureContext : public TextureContext, public SimpleLruPage {
class EXPCL_TINYDISPLAY TinyTextureContext : public TextureContext, public SimpleLruPage {
public:
INLINE TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex);
ALLOC_DELETED_CHAIN(TinyTextureContext);

View File

@ -53,7 +53,7 @@ typedef int XIC;
// creating OpenGL graphics windows on an X-based
// (e.g. Unix) client.
////////////////////////////////////////////////////////////////////
class TinyXGraphicsPipe : public GraphicsPipe {
class EXPCL_TINYDISPLAY TinyXGraphicsPipe : public GraphicsPipe {
public:
TinyXGraphicsPipe(const string &display = string());
virtual ~TinyXGraphicsPipe();

View File

@ -32,7 +32,7 @@
// Description : Opens a window on X11 to display the TinyGL software
// rendering.
////////////////////////////////////////////////////////////////////
class TinyXGraphicsWindow : public GraphicsWindow {
class EXPCL_TINYDISPLAY TinyXGraphicsWindow : public GraphicsWindow {
public:
TinyXGraphicsWindow(GraphicsPipe *pipe,
const string &name,

View File

@ -8,13 +8,13 @@ void gl_eval_viewport(GLContext * c)
v = &c->viewport;
v->trans.X = ((v->xsize - 0.5) / 2.0) + v->xmin;
v->trans.Y = ((v->ysize - 0.5) / 2.0) + v->ymin;
v->trans.Z = ((zsize - 0.5) / 2.0) + ((1 << ZB_POINT_Z_FRAC_BITS)) / 2;
v->trans.X = ((v->xsize - 0.5f) / 2.0f) + v->xmin;
v->trans.Y = ((v->ysize - 0.5f) / 2.0f) + v->ymin;
v->trans.Z = ((zsize - 0.5f) / 2.0f) + ((1 << ZB_POINT_Z_FRAC_BITS)) / 2;
v->scale.X = (v->xsize - 0.5) / 2.0;
v->scale.Y = -(v->ysize - 0.5) / 2.0;
v->scale.Z = -((zsize - 0.5) / 2.0);
v->scale.X = (v->xsize - 0.5f) / 2.0f;
v->scale.Y = -(v->ysize - 0.5f) / 2.0f;
v->scale.Z = -((zsize - 0.5f) / 2.0f);
}
/* coords, tranformation , clip code and projection */

View File

@ -18,7 +18,7 @@ ZBuffer *ZB_open(int xsize, int ysize, int mode,
ZBuffer *zb;
int size;
zb = gl_malloc(sizeof(ZBuffer));
zb = (ZBuffer *)gl_malloc(sizeof(ZBuffer));
if (zb == NULL)
return NULL;
@ -51,12 +51,12 @@ ZBuffer *ZB_open(int xsize, int ysize, int mode,
size = zb->xsize * zb->ysize * sizeof(unsigned short);
zb->zbuf = gl_malloc(size);
zb->zbuf = (unsigned short *)gl_malloc(size);
if (zb->zbuf == NULL)
goto error;
if (frame_buffer == NULL) {
zb->pbuf = gl_malloc(zb->ysize * zb->linesize);
zb->pbuf = (PIXEL *)gl_malloc(zb->ysize * zb->linesize);
if (zb->pbuf == NULL) {
gl_free(zb->zbuf);
goto error;
@ -64,7 +64,7 @@ ZBuffer *ZB_open(int xsize, int ysize, int mode,
zb->frame_buffer_allocated = 1;
} else {
zb->frame_buffer_allocated = 0;
zb->pbuf = frame_buffer;
zb->pbuf = (PIXEL *)frame_buffer;
}
zb->current_texture.pixmap = NULL;
@ -102,16 +102,16 @@ void ZB_resize(ZBuffer * zb, void *frame_buffer, int xsize, int ysize)
size = zb->xsize * zb->ysize * sizeof(unsigned short);
gl_free(zb->zbuf);
zb->zbuf = gl_malloc(size);
zb->zbuf = (unsigned short *)gl_malloc(size);
if (zb->frame_buffer_allocated)
gl_free(zb->pbuf);
if (frame_buffer == NULL) {
zb->pbuf = gl_malloc(zb->ysize * zb->linesize);
zb->pbuf = (PIXEL *)gl_malloc(zb->ysize * zb->linesize);
zb->frame_buffer_allocated = 1;
} else {
zb->pbuf = frame_buffer;
zb->pbuf = (PIXEL *)frame_buffer;
zb->frame_buffer_allocated = 0;
}
}
@ -125,7 +125,7 @@ static void ZB_copyBuffer(ZBuffer * zb,
int y, n;
q = zb->pbuf;
p1 = buf;
p1 = (unsigned char *)buf;
n = zb->xsize * PSZB;
for (y = 0; y < zb->ysize; y++) {
memcpy(p1, q, n);
@ -224,7 +224,7 @@ void memset_s(void *adr, int val, int count)
unsigned int *p;
unsigned short *q;
p = adr;
p = (unsigned int *)adr;
v = val | (val << 16);
n = count >> 3;
@ -247,7 +247,7 @@ void memset_l(void *adr, int val, int count)
int i, n, v;
unsigned int *p;
p = adr;
p = (unsigned int *)adr;
v = val;
n = count >> 2;
for (i = 0; i < n; i++) {

View File

@ -9,9 +9,6 @@
#include "zmath.h"
#include "zfeatures.h"
#define DEBUG
/* #define NDEBUG */
/* initially # of allocated GLVertexes (will grow when necessary) */
#define POLYGON_MAX_VERTEX 16
@ -228,33 +225,16 @@ void gl_fatal_error(char *format, ...);
GLSpecBuf *specbuf_get_buffer(GLContext *c, const int shininess_i,
const float shininess);
#ifdef __BEOS__
void dprintf(const char *, ...);
#else /* !BEOS */
#ifdef DEBUG
#define dprintf(format, args...) \
fprintf(stderr,"In '%s': " format "\n",__FUNCTION__, ##args);
#else
#define dprintf(format, args...)
#endif
#endif /* !BEOS */
/* this clip epsilon is needed to avoid some rounding errors after
several clipping stages */
#define CLIP_EPSILON (1E-5)
#define CLIP_EPSILON (1E-5f)
static inline int gl_clipcode(float x,float y,float z,float w1)
{
float w;
w=w1 * (1.0 + CLIP_EPSILON);
w = w1 * (1.0f + CLIP_EPSILON);
return (x<-w) |
((x>w)<<1) |
((y<-w)<<2) |

View File

@ -18,28 +18,28 @@
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zon_noblend_aless_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zon_noblend_aless_zless
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zon_noblend_amore_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zon_noblend_amore_zless
#include "ztriangle_two.h"
@ -60,28 +60,28 @@
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zon_blend_aless_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zon_blend_aless_zless
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zon_blend_amore_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zon_blend_amore_zless
#include "ztriangle_two.h"
@ -102,28 +102,28 @@
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zon_nocolor_aless_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zon_nocolor_aless_zless
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zon_nocolor_amore_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z) (zpix) = (z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zon_nocolor_amore_zless
#include "ztriangle_two.h"
@ -144,28 +144,28 @@
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zoff_noblend_aless_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zoff_noblend_aless_zless
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zoff_noblend_amore_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zoff_noblend_amore_zless
#include "ztriangle_two.h"
@ -186,28 +186,28 @@
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zoff_blend_aless_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zoff_blend_aless_zless
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zoff_blend_amore_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zoff_blend_amore_zless
#include "ztriangle_two.h"
@ -228,28 +228,28 @@
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zoff_nocolor_aless_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) < (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) < (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zoff_nocolor_aless_zless
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) 1
#define FNAME(name) name ## _xx_zoff_nocolor_amore_znone
#include "ztriangle_two.h"
#define STORE_Z(zpix, z)
#define STORE_PIX(pix, rgb, r, g, b, a)
#define ACMP(zb,a) ((a) > (zb)->reference_alpha)
#define ACMP(zb,a) (((unsigned int)(a)) > (zb)->reference_alpha)
#define ZCMP(zpix, z) ((zpix) < (z))
#define FNAME(name) name ## _xx_zoff_nocolor_amore_zless
#include "ztriangle_two.h"

View File

@ -55,16 +55,16 @@
/* we compute dXdx and dXdy for all interpolated values */
fdx1 = p1->x - p0->x;
fdy1 = p1->y - p0->y;
fdx1 = (float) (p1->x - p0->x);
fdy1 = (float) (p1->y - p0->y);
fdx2 = p2->x - p0->x;
fdy2 = p2->y - p0->y;
fdx2 = (float) (p2->x - p0->x);
fdy2 = (float) (p2->y - p0->y);
fz = fdx1 * fdy2 - fdx2 * fdy1;
if (fz == 0)
return;
fz = 1.0 / fz;
fz = 1.0f / fz;
fdx1 *= fz;
fdy1 *= fz;
@ -72,43 +72,43 @@
fdy2 *= fz;
#ifdef INTERP_Z
d1 = p1->z - p0->z;
d2 = p2->z - p0->z;
d1 = (float) (p1->z - p0->z);
d2 = (float) (p2->z - p0->z);
dzdx = (int) (fdy2 * d1 - fdy1 * d2);
dzdy = (int) (fdx1 * d2 - fdx2 * d1);
#endif
#ifdef INTERP_RGB
d1 = p1->r - p0->r;
d2 = p2->r - p0->r;
d1 = (float) (p1->r - p0->r);
d2 = (float) (p2->r - p0->r);
drdx = (int) (fdy2 * d1 - fdy1 * d2);
drdy = (int) (fdx1 * d2 - fdx2 * d1);
d1 = p1->g - p0->g;
d2 = p2->g - p0->g;
d1 = (float) (p1->g - p0->g);
d2 = (float) (p2->g - p0->g);
dgdx = (int) (fdy2 * d1 - fdy1 * d2);
dgdy = (int) (fdx1 * d2 - fdx2 * d1);
d1 = p1->b - p0->b;
d2 = p2->b - p0->b;
d1 = (float) (p1->b - p0->b);
d2 = (float) (p2->b - p0->b);
dbdx = (int) (fdy2 * d1 - fdy1 * d2);
dbdy = (int) (fdx1 * d2 - fdx2 * d1);
d1 = p1->a - p0->a;
d2 = p2->a - p0->a;
d1 = (float) (p1->a - p0->a);
d2 = (float) (p2->a - p0->a);
dadx = (int) (fdy2 * d1 - fdy1 * d2);
dady = (int) (fdx1 * d2 - fdx2 * d1);
#endif
#ifdef INTERP_ST
d1 = p1->s - p0->s;
d2 = p2->s - p0->s;
d1 = (float) (p1->s - p0->s);
d2 = (float) (p2->s - p0->s);
dsdx = (int) (fdy2 * d1 - fdy1 * d2);
dsdy = (int) (fdx1 * d2 - fdx2 * d1);
d1 = p1->t - p0->t;
d2 = p2->t - p0->t;
d1 = (float) (p1->t - p0->t);
d2 = (float) (p2->t - p0->t);
dtdx = (int) (fdy2 * d1 - fdy1 * d2);
dtdy = (int) (fdx1 * d2 - fdx2 * d1);
#endif

View File

@ -283,7 +283,7 @@ void FNAME(ZB_fillTriangleMappingPerspective) (ZBuffer *zb,
float sz,tz,fz,zinv; \
n=(x2>>16)-x1; \
fz=(float)z1; \
zinv=1.0 / fz; \
zinv=1.0f / fz; \
pp=(PIXEL *)((char *)pp1 + x1 * PSZB); \
pz=pz1+x1; \
z=z1; \
@ -299,7 +299,7 @@ void FNAME(ZB_fillTriangleMappingPerspective) (ZBuffer *zb,
dsdx= (int)( (dszdx - ss*fdzdx)*zinv ); \
dtdx= (int)( (dtzdx - tt*fdzdx)*zinv ); \
fz+=fndzdx; \
zinv=1.0 / fz; \
zinv=1.0f / fz; \
} \
PUT_PIXEL(0); \
PUT_PIXEL(1); \
@ -402,7 +402,7 @@ void FNAME(ZB_fillTriangleMappingPerspectiveFlat) (ZBuffer *zb,
float sz,tz,fz,zinv; \
n=(x2>>16)-x1; \
fz=(float)z1; \
zinv=1.0 / fz; \
zinv=1.0f / fz; \
pp=(PIXEL *)((char *)pp1 + x1 * PSZB); \
pz=pz1+x1; \
z=z1; \
@ -422,7 +422,7 @@ void FNAME(ZB_fillTriangleMappingPerspectiveFlat) (ZBuffer *zb,
dsdx= (int)( (dszdx - ss*fdzdx)*zinv ); \
dtdx= (int)( (dtzdx - tt*fdzdx)*zinv ); \
fz+=fndzdx; \
zinv=1.0 / fz; \
zinv=1.0f / fz; \
} \
PUT_PIXEL(0); \
PUT_PIXEL(1); \
@ -537,7 +537,7 @@ void FNAME(ZB_fillTriangleMappingPerspectiveSmooth) (ZBuffer *zb,
float sz,tz,fz,zinv; \
n=(x2>>16)-x1; \
fz=(float)z1; \
zinv=1.0 / fz; \
zinv=1.0f / fz; \
pp=(PIXEL *)((char *)pp1 + x1 * PSZB); \
pz=pz1+x1; \
z=z1; \
@ -557,7 +557,7 @@ void FNAME(ZB_fillTriangleMappingPerspectiveSmooth) (ZBuffer *zb,
dsdx= (int)( (dszdx - ss*fdzdx)*zinv ); \
dtdx= (int)( (dtzdx - tt*fdzdx)*zinv ); \
fz+=fndzdx; \
zinv=1.0 / fz; \
zinv=1.0f / fz; \
} \
PUT_PIXEL(0); \
PUT_PIXEL(1); \