- use build in data types

git-svn-id: http://moon:8086/svn/mips@35 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2015-05-28 19:19:01 +00:00
parent 3263f9d79c
commit a655e1c5d9
54 changed files with 1551 additions and 1583 deletions
+13 -13
View File
@@ -55,28 +55,28 @@ ri_var_t* V_CONSTANTWIDTH = NULL;
typedef struct _sjmalloc_t
{
UINT32 size;
uint32_t size;
void* pMem;
struct _sjmalloc_t *pPrev;
struct _sjmalloc_t *pNext;
} jmalloc_t;
linkedlist_t *pMallocs = NULL;
UINT32 nmallocs = 0;
uint32_t nmallocs = 0;
// Renderer functions
void* jmalloc(UINT32 size)
void* jmalloc(uint32_t size)
{
void *pMem;
pMem = malloc(size);
// pMallocs = LinkedList_add(pMallocs, (UINT32)pMem, (void*)&size, sizeof(void*));
// pMallocs = LinkedList_add(pMallocs, (uint32_t)pMem, (void*)&size, sizeof(void*));
nmallocs++;
return pMem;
}
void jfree(void *pMem)
{
// pMallocs = LinkedList_del(LinkedList_find_by_id(pMallocs, (UINT32)pMem));
// pMallocs = LinkedList_del(LinkedList_find_by_id(pMallocs, (uint32_t)pMem));
nmallocs--;
free(pMem);
}
@@ -84,11 +84,11 @@ void jfree(void *pMem)
void jstats()
{
linkedlist_t *pList;
UINT32 n= 0, size = 0;
uint32_t n= 0, size = 0;
pList = LinkedList_find_first(pMallocs);
while(pList)
{
size += (UINT32)pList->size;
size += (uint32_t)pList->size;
pList = pList->pNext;
n++;
}
@@ -174,12 +174,12 @@ void Engine_free(engine_t *pObj)
}
void Engine_context_set(engine_t *pObj, UINT32 context, UINT32 level)
void Engine_context_set(engine_t *pObj, uint32_t context, uint32_t level)
{
pObj->pContext[level] = context;
}
UINT32 Engine_context_get(engine_t *pObj, UINT32 level)
uint32_t Engine_context_get(engine_t *pObj, uint32_t level)
{
if (!pObj->pContext)
return ENGINE_CONTEXT_INVALID;
@@ -207,7 +207,7 @@ void Engine_Render(engine_t *pObj)
object_t *pMesh;
object_t *pObject;
RtFloat kf, fi;
UINT32 im_width, im_height, x, y, i, j;
uint32_t im_width, im_height, x, y, i, j;
image_t im;
rgba_t *pCs;
double tictoc;
@@ -215,8 +215,8 @@ void Engine_Render(engine_t *pObj)
Tic(&tictoc);
kf = (RtFloat)pG->pOpt->format.xres/(pG->pOpt->format.yres*pG->pOpt->format.ar_f);
im_width = (UINT32)pG->pOpt->format.xres;
im_height = (UINT32)(kf*pG->pOpt->format.yres + 0.5);
im_width = (uint32_t)pG->pOpt->format.xres;
im_height = (uint32_t)(kf*pG->pOpt->format.yres + 0.5);
if (pG->pOpt->display.mode == RI_RGBA)
ImageInit(&im, im_width, im_height, 4);
@@ -359,7 +359,7 @@ void Engine_DeleteScene(engine_t *pObj)
// --------------------------------------------------------------
void Engine_SceneInfo(engine_t *pObj)
{
UINT32 num_verts = 0, num_objects = 0;
uint32_t num_verts = 0, num_objects = 0;
linkedlist_t *pObjList;
polygon_t *pPoly;
object_t *pObject;
+4 -4
View File
@@ -31,7 +31,7 @@ extern ri_var_t* V_ST;
extern ri_var_t* V_WIDTH;
extern ri_var_t* V_CONSTANTWIDTH;
typedef UINT32 context_t;
typedef uint32_t context_t;
typedef struct _sengine_t
{
@@ -50,8 +50,8 @@ typedef struct _sengine_t
// JayMan functions
void Engine_init(engine_t *pObj, RtToken name);
void Engine_free(engine_t *pObj);
void Engine_context_set(engine_t *pObj, UINT32 context, UINT32 level);
UINT32 Engine_context_get(engine_t *pObj, UINT32 level);
void Engine_context_set(engine_t *pObj, uint32_t context, uint32_t level);
uint32_t Engine_context_get(engine_t *pObj, uint32_t level);
void Engine_context_push(engine_t *pObj);
void Engine_context_pop(engine_t *pObj);
@@ -59,7 +59,7 @@ void Engine_Render(engine_t *pObj);
void Engine_DeleteScene(engine_t *pObj);
void Engine_SceneInfo(engine_t *pObj);
void* jmalloc(UINT32 size);
void* jmalloc(uint32_t size);
void jfree(void *pMem);
void jstats(void);
+2 -2
View File
@@ -14,7 +14,7 @@ static char RI_DEFAULT_FILNAME[] = "ri.pic";
// Graphics state functions
void GS_init(graph_state_t *pObj)
{
UINT32 i;
uint32_t i;
pObj->pAttr_stack = Stack_push(NULL, &pObj->pAttr, sizeof(attr_t));
pObj->pOpt_stack = Stack_push(NULL, &pObj->pOpt, sizeof(opt_t));
@@ -95,7 +95,7 @@ void GS_xform_pop(graph_state_t *pObj)
GS_xform_set(pObj, pObj->curr_xform);
}
void GS_xform_set(graph_state_t *pObj, UINT32 id)
void GS_xform_set(graph_state_t *pObj, uint32_t id)
{
pObj->curr_xform = id;
pObj->pXform_curr = &pObj->pXform->space[id];
+5 -5
View File
@@ -22,7 +22,7 @@ typedef struct _sprojection_t
{
RtToken type;
RtFloat fov;
UINT32 flags;
uint32_t flags;
} projection_t;
@@ -64,9 +64,9 @@ typedef struct _sxform_t
typedef struct _sgraph_state_t
{
UINT32 frame;
UINT32 context;
UINT32 curr_xform;
uint32_t frame;
uint32_t context;
uint32_t curr_xform;
opt_t *pOpt;
attr_t *pAttr;
xform_t *pXform;
@@ -90,7 +90,7 @@ void GS_attr_push(graph_state_t *pObj);
void GS_attr_pop(graph_state_t *pObj);
void GS_xform_push(graph_state_t *pObj);
void GS_xform_pop(graph_state_t *pObj);
void GS_xform_set(graph_state_t *pObj, UINT32 id);
void GS_xform_set(graph_state_t *pObj, uint32_t id);
#endif // GRAPH_STATE_H
+9 -8
View File
@@ -1,3 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -10,9 +11,9 @@
#include "graph_state.h"
#include "object.h"
void Grid_create(grid_t *pObj, UINT32 npu, UINT32 npv)
void Grid_create(grid_t *pObj, uint32_t npu, uint32_t npv)
{
UINT32 i, j, k, nu, nv;
uint32_t i, j, k, nu, nv;
ri_var_t *pVar;
nu = npu + 1;
@@ -105,7 +106,7 @@ void Grid_CopyVarByName(grid_t *pObj, RtToken pDstName, RtToken pSrcName)
void Grid_InitUV(grid_t *pObj)
{
UINT32 i, j, k, nu, nv;
uint32_t i, j, k, nu, nv;
RtFloat *pU, *pV, u, v, du, dv;
ri_var_t *pVar;
@@ -146,7 +147,7 @@ void Grid_InitUV(grid_t *pObj)
void Grid_assign_derivs(grid_t *pObj)
{
UINT32 i, j, k, nu, nv;
uint32_t i, j, k, nu, nv;
RtPoint *pPoint, *pDPDU, *pDPDV, dpd2;
RtFloat du, dv, ik;
ri_var_t *pVar;
@@ -202,7 +203,7 @@ void Grid_assign_derivs(grid_t *pObj)
void Grid_calc_normal(grid_t *pObj, RtToken name)
{
UINT32 i;
uint32_t i;
RtFloat *a, *b;
RtPoint *pPoint, *pDPDU, *pDPDV, *pN;
@@ -224,7 +225,7 @@ void Grid_calc_normal(grid_t *pObj, RtToken name)
void Grid_displace(grid_t *pObj)
{
UINT32 i, j, k;
uint32_t i, j, k;
RtPoint *pP, *pDPDU, *pDPDV, *pN;
RtColor *pCs, *pCi;
RtFloat *pU, *pV, fd, kn, kd;
@@ -351,7 +352,7 @@ RtFloat* Specular(linkedlist_t *pLightList, RtPoint N, RtPoint P, RtPoint I, RtF
void Grid_shade(grid_t *pObj, RtMatrix *pXform, linkedlist_t *pLights)
{
UINT32 i, j, k;
uint32_t i, j, k;
RtPoint *pP, *pDPDU, *pDPDV, *pN, *pI;
RtColor *pCs, *pCi;
RtFloat *pU, *pV, fd, kn, vt, p[4], d[4], *pCl_diff, *pCl_spec;
@@ -391,7 +392,7 @@ void Grid_shade(grid_t *pObj, RtMatrix *pXform, linkedlist_t *pLights)
void Grid_shadeConstant(grid_t *pObj)
{
UINT32 i;
uint32_t i;
RtColor *pCs, *pCi;
pCs = (RtColor*)VarGetByName(&pObj->vars, "Cs");
+8 -8
View File
@@ -3,18 +3,18 @@
typedef struct _spoint_state_t
{
UINT32 active;
UINT32 shaded;
UINT32 visible;
UINT32 has_face;
UINT32 has_normal;
uint32_t active;
uint32_t shaded;
uint32_t visible;
uint32_t has_face;
uint32_t has_normal;
} point_state_t;
typedef UINT32 pixelpos_t[2];
typedef uint32_t pixelpos_t[2];
typedef struct _sgrid_t
{
UINT32 nu, nv, npoints;
uint32_t nu, nv, npoints;
var_list_t vars;
pixelpos_t *pPointPos;
point_state_t *pPointState;
@@ -23,7 +23,7 @@ typedef struct _sgrid_t
void Grid_init(void);
void Grid_free(grid_t *pObj);
void Grid_create(grid_t *pObj, UINT32 nu, UINT32 nv);
void Grid_create(grid_t *pObj, uint32_t nu, uint32_t nv);
void Grid_assign_params(grid_t *pObj);
void Grid_assign_derivs(grid_t *pObj);
void Grid_calc_Ng(grid_t *pObj);
+18 -18
View File
@@ -39,16 +39,16 @@ void ImageInit(image_t *pObj, int im_width, int im_height, int num_ch)
pObj->im_width = im_width;
pObj->num_ch = num_ch;
pObj->num_pixel = im_height*im_width;
volatile UINT32 *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL;
volatile UINT32 *pVGA_front = (UINT32*)SYS_VGA_FB_FRONT;
volatile UINT32 *pVGA_back = (UINT32*)SYS_VGA_FB_BACK;
volatile uint32_t *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL;
volatile uint32_t *pVGA_front = (uint32_t*)SYS_VGA_FB_FRONT;
volatile uint32_t *pVGA_back = (uint32_t*)SYS_VGA_FB_BACK;
pObj->pColor_data = (UINT64*)jmalloc(pObj->num_pixel*sizeof(UINT32));
memset(pObj->pColor_data, 0, pObj->num_pixel*sizeof(UINT32));
printf("pPixelBuf : %8.8X\n", (UINT32)pObj->pColor_data);
pObj->pColor_data = (uint64_t*)jmalloc(pObj->num_pixel*sizeof(uint32_t));
memset(pObj->pColor_data, 0, pObj->num_pixel*sizeof(uint32_t));
printf("pPixelBuf : %8.8X\n", (uint32_t)pObj->pColor_data);
*pVGA_front = (UINT32)pObj->pColor_data;
*pVGA_back = (UINT32)pObj->pColor_data;
*pVGA_front = (uint32_t)pObj->pColor_data;
*pVGA_back = (uint32_t)pObj->pColor_data;
*pVGA_ctrl |= SYS_VGA_BIT_MSTEN;
}
@@ -99,29 +99,29 @@ int ImageSaveTiff(image_t *pObj, char *filename)
}
void ImageSetPixel(image_t *pObj, UINT32 u, UINT32 v, rgba_t color)
void ImageSetPixel(image_t *pObj, uint32_t u, uint32_t v, rgba_t color)
{
UINT32 offset;
UINT32 *pRGB;
UINT32 *pRGBA;
uint32_t offset;
uint32_t *pRGB;
uint32_t *pRGBA;
pRGB = (UINT32*)pObj->pColor_data;
pRGBA = (UINT32*)pObj->pColor_data;
pRGB = (uint32_t*)pObj->pColor_data;
pRGBA = (uint32_t*)pObj->pColor_data;
if (pObj->num_ch == 4)
{
if ((u < pObj->im_width) && (v < pObj->im_height))
{
offset = (UINT32)(pObj->im_width*v);
pRGBA[u+offset] = ((UINT32)(255*color[0]) & 0xFF) | (((UINT32)(255*color[1]) & 0xFF) << 8) | (((UINT32)(255*color[2]) & 0xFF) << 16);
offset = (uint32_t)(pObj->im_width*v);
pRGBA[u+offset] = ((uint32_t)(255*color[0]) & 0xFF) | (((uint32_t)(255*color[1]) & 0xFF) << 8) | (((uint32_t)(255*color[2]) & 0xFF) << 16);
}
}
else
{
if ((u < pObj->im_width) && (v < pObj->im_height))
{
offset = (UINT32)(pObj->im_width*v);
pRGB[u+offset] = ((UINT32)(255*color[0]) & 0xFF) | (((UINT32)(255*color[1]) & 0xFF) << 8) | (((UINT32)(255*color[2]) & 0xFF) << 16);
offset = (uint32_t)(pObj->im_width*v);
pRGB[u+offset] = ((uint32_t)(255*color[0]) & 0xFF) | (((uint32_t)(255*color[1]) & 0xFF) << 8) | (((uint32_t)(255*color[2]) & 0xFF) << 16);
}
}
+3 -3
View File
@@ -15,8 +15,8 @@
// ------------------------------------------------------------
typedef struct _image_t
{
UINT32 im_width, im_height, num_pixel, num_ch;
UINT64 *pColor_data;
uint32_t im_width, im_height, num_pixel, num_ch;
uint64_t *pColor_data;
} image_t;
@@ -27,7 +27,7 @@ void ImageFree(image_t *pObj);
void ImageCopy(image_t *pSrc, image_t *pDst);
int ImageLoadTiff(image_t *pObj, char *filename);
int ImageSaveTiff(image_t *pObj, char *filename);
void ImageSetPixel(image_t *pObj, UINT32 u, UINT32 v, rgba_t color);
void ImageSetPixel(image_t *pObj, uint32_t u, uint32_t v, rgba_t color);
// ------------------------------------------------------------
#endif // IMAGEIO_H
+7 -7
View File
@@ -15,9 +15,9 @@ linkedlist_t* LinkedList_free(linkedlist_t *pObj)
return pCurr;
}
linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 num, UINT32 size)
linkedlist_t* LinkedList_append(linkedlist_t *pObj, uint32_t num, uint32_t size)
{
UINT32 i;
uint32_t i;
linkedlist_t *pCurr, *pLast;
char *pData = NULL;
@@ -60,7 +60,7 @@ linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 num, UINT32 size)
}
/*
linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 id, UINT32 size)
linkedlist_t* LinkedList_append(linkedlist_t *pObj, uint32_t id, uint32_t size)
{
linkedlist_t *pCurr;
@@ -90,7 +90,7 @@ linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 id, UINT32 size)
}
*/
linkedlist_t* LinkedList_add(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size)
linkedlist_t* LinkedList_add(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size)
{
linkedlist_t *pCurr;
@@ -100,7 +100,7 @@ linkedlist_t* LinkedList_add(linkedlist_t *pObj, UINT32 num, void *pData, UINT32
}
linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, UINT32 size)
linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, uint32_t size)
{
linkedlist_t *pCurr;
@@ -162,7 +162,7 @@ linkedlist_t* LinkedList_del(linkedlist_t *pObj)
return pCurr;
}
linkedlist_t* LinkedList_ins(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size)
linkedlist_t* LinkedList_ins(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size)
{
linkedlist_t *pCurr, *pNext;
@@ -212,7 +212,7 @@ linkedlist_t* LinkedList_find_last(linkedlist_t *pObj)
return pCurr;
}
/*
linkedlist_t* LinkedList_find_by_id(linkedlist_t *pObj, UINT32 id)
linkedlist_t* LinkedList_find_by_id(linkedlist_t *pObj, uint32_t id)
{
linkedlist_t *pCurr;
+6 -6
View File
@@ -7,8 +7,8 @@
typedef struct _slinkedlist_t
{
UINT32 id;
UINT32 size;
uint32_t id;
uint32_t size;
void *pData;
struct _slinkedlist_t *pNext;
struct _slinkedlist_t *pPrev;
@@ -16,10 +16,10 @@ typedef struct _slinkedlist_t
} linkedlist_t;
linkedlist_t* LinkedList_free(linkedlist_t *pObj);
linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 num, UINT32 size);
linkedlist_t* LinkedList_add(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size);
linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, UINT32 size);
linkedlist_t* LinkedList_ins(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size);
linkedlist_t* LinkedList_append(linkedlist_t *pObj, uint32_t num, uint32_t size);
linkedlist_t* LinkedList_add(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size);
linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, uint32_t size);
linkedlist_t* LinkedList_ins(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size);
void* LinkedList_get(linkedlist_t *pObj);
linkedlist_t* LinkedList_del(linkedlist_t *pObj);
linkedlist_t* LinkedList_find_first(linkedlist_t *pObj);
+16 -16
View File
@@ -54,9 +54,9 @@
// Ausgabe einer nxn-Matrix
void PrintMatrix (RtMatrix M, UINT32 d)
void PrintMatrix (RtMatrix M, uint32_t d)
{
UINT32 i,j;
uint32_t i,j;
printf("\n");
for (i=0;i<d;++i)
{
@@ -69,9 +69,9 @@ void PrintMatrix (RtMatrix M, UINT32 d)
}
// Ausgabe eines Vektors in Zeilenform
void PrintVector (RtFloat *u, UINT32 d)
void PrintVector (RtFloat *u, uint32_t d)
{
UINT32 i;
uint32_t i;
printf("\n\t ( ");
for (i=0;i<d-1;++i)
printf("%g, ",fabs(u[i])<min?0:u[i]);
@@ -80,9 +80,9 @@ void PrintVector (RtFloat *u, UINT32 d)
// Berechnung des Skalarprodukts <.,.> zwischen zwei Vektoren u, v;
// <u,v> = u[1]*v[1] + u[2]*v[2] + ... + u[n]*v[n]
RtFloat ScalarProduct (RtFloat *u, RtFloat *v, UINT32 d)
RtFloat ScalarProduct (RtFloat *u, RtFloat *v, uint32_t d)
{
UINT32 i;
uint32_t i;
RtFloat s=0.0;
for (i=0;i<d;++i)
s += u[i]*v[i];
@@ -90,7 +90,7 @@ RtFloat ScalarProduct (RtFloat *u, RtFloat *v, UINT32 d)
}
// Berechnung des Betrags eines Vektors
RtFloat Norm (RtFloat *u, UINT32 d)
RtFloat Norm (RtFloat *u, uint32_t d)
{
RtFloat m;
m = (RtFloat)sqrt(ScalarProduct(u,u,d));
@@ -100,7 +100,7 @@ RtFloat Norm (RtFloat *u, UINT32 d)
// Berechnung des Winkels zwischen zwei Vektoren u, v.
// Verfahren: cos(u,v) = <u,v>/(|u|*|v|), wobei <.,.> das Skalarprodukt
// zwischen zwei Vektoren und |.| der Betrag eines Vektors sind.
RtFloat AngleBetweenVectors (RtFloat *u, RtFloat *v, UINT32 d)
RtFloat AngleBetweenVectors (RtFloat *u, RtFloat *v, uint32_t d)
{
RtFloat p;
p = (RtFloat)acos(ScalarProduct(u,v,d)/(Norm(u,d)*Norm(v,d)));
@@ -111,7 +111,7 @@ RtFloat AngleBetweenVectors (RtFloat *u, RtFloat *v, UINT32 d)
// Liefert die Einheitsmatrix in Id zurueck.
void IdentityMatrix (RtMatrix *Id)
{
UINT32 i,j;
uint32_t i,j;
for (i=0;i<4;++i)
for (j=0;j<4;++j)
(*Id)[i][j] = (RtFloat)(i==j);
@@ -121,7 +121,7 @@ void IdentityMatrix (RtMatrix *Id)
// Das Ergebnis der Multiplikation von M und N steht in der Matrix MN.
void MultiplyMatrices (RtMatrix M, RtMatrix N, RtMatrix *MN)
{
INT32 i,j;
int32_t i,j;
for (i=0; i<4; i++)
{
for (j=0; j<4; j++)
@@ -138,7 +138,7 @@ void MultiplyMatrices (RtMatrix M, RtMatrix N, RtMatrix *MN)
// Multiplikation einer 4x4-Matrix M und eines Spaltenvektors u
void MultiplyMatrixVector (RtMatrix M, RtFloat *u, RtFloat *Mu)
{
INT32 i;
int32_t i;
for (i=0; i<4; i++)
{
@@ -152,7 +152,7 @@ void MultiplyMatrixVector (RtMatrix M, RtFloat *u, RtFloat *Mu)
void MultiplyMatrixVector2 (RtMatrix M, RtFloat *u, RtFloat *Mu)
{
INT32 i;
int32_t i;
RtFloat res[3];
for (i=0; i < 3; i++)
@@ -168,7 +168,7 @@ void MultiplyMatrixVector2 (RtMatrix M, RtFloat *u, RtFloat *Mu)
// Multiplikation eines Zeilenvektors u und einer 4x4-Matrix M
void MultiplyVectorMatrix (RtFloat *u, RtMatrix M, RtFloat *uM)
{
INT32 i;
int32_t i;
for (i=0;i<4;++i)
{
@@ -183,7 +183,7 @@ void MultiplyVectorMatrix (RtFloat *u, RtMatrix M, RtFloat *uM)
// Transponieren einer 4x4-Matrix M; Mt: transponierte Matrix M
void TransposeMatrix (RtMatrix M, RtMatrix *Mt)
{
INT32 i;
int32_t i;
for (i=0; i<4; i++)
{
(*Mt)[i][0] = M[0][i];
@@ -208,7 +208,7 @@ void NewTranslationMatrix (RtFloat *tval, RtMatrix *T)
// Berechnung der Rotationsmatrix R aus M (Verfahren s. oben)
void RotationMatrix (RtMatrix M, RtMatrix *R)
{
UINT32 i;
uint32_t i;
for (i=0; i<4; i++)
{
(*R)[i][0] = M[i][0];
@@ -241,7 +241,7 @@ void InverseRotationMatrix (RtMatrix R, RtMatrix *Ri)
// (Verfahren s. oben)
void InverseTranslationMatrix (RtMatrix T, RtMatrix *Ti)
{
UINT32 i;
uint32_t i;
//printf("T = "); PrintMatrix(T);
IdentityMatrix (Ti);
for (i=0;i<3;++i)
+14 -14
View File
@@ -34,9 +34,9 @@ void Interpolate_linear_u(RtPoint P0, RtPoint P1, RtPoint* pP, RtFloat u)
}
void Interpolate_linear(RtPoint P0, RtPoint P1, RtPoint *pP, UINT32 N)
void Interpolate_linear(RtPoint P0, RtPoint P1, RtPoint *pP, uint32_t N)
{
UINT32 i;
uint32_t i;
RtFloat dx, dy, dz, fx, fy, fz;
fx = P0[0];
@@ -55,13 +55,13 @@ void Interpolate_linear(RtPoint P0, RtPoint P1, RtPoint *pP, UINT32 N)
}
RtInt Interpolate_cubic(RtPoint *pCP, UINT32 ncp, RtPoint *pIP, UINT32 nip, RtFloat umin, RtFloat umax, RtPointer Basis, RtInt step, RtInt dimcp)
RtInt Interpolate_cubic(RtPoint *pCP, uint32_t ncp, RtPoint *pIP, uint32_t nip, RtFloat umin, RtFloat umax, RtPointer Basis, RtInt step, RtInt dimcp)
{
UINT32 i, j, jj, k, d, n, np;
uint32_t i, j, jj, k, d, n, np;
RtFloat Bi[3][4], p[4], ut, u, du;
RtFloat *B = (RtFloat*)Basis;
INT32 ii;
int32_t ii;
np = (ncp-4)/step + 1;
@@ -102,7 +102,7 @@ RtInt Interpolate_cubic(RtPoint *pCP, UINT32 ncp, RtPoint *pIP, UINT32 nip, RtFl
}
// --------------------------------------------------------------
void Polygon_init(object_t *pObj, UINT32 id, UINT32 nvertices)
void Polygon_init(object_t *pObj, uint32_t id, uint32_t nvertices)
{
polygon_t *pObject;
ri_var_t *pVar;
@@ -142,7 +142,7 @@ void Polygon_dice(object_t *pObj, RtInt npu, RtInt npv)
}
// --------------------------------------------------------------
void Curve_init(object_t *pObj, UINT32 id, RtToken degree, RtInt nverts, RtToken wrap)
void Curve_init(object_t *pObj, uint32_t id, RtToken degree, RtInt nverts, RtToken wrap)
{
curve_t *pObject;
@@ -180,7 +180,7 @@ void Curve_bound_update(object_t *pObj)
}
// --------------------------------------------------------------
void Patch_init(object_t *pObj, UINT32 id, RtToken type)
void Patch_init(object_t *pObj, uint32_t id, RtToken type)
{
patch_t *pObject;
@@ -300,7 +300,7 @@ void Patch_dice(object_t *pObj, RtInt npu, RtInt npv)
void Patch_bound_update(object_t *pObj)
{
UINT32 i, j, npoints;
uint32_t i, j, npoints;
patch_t *pObject;
RtPoint *pPoints;
@@ -328,7 +328,7 @@ void Patch_bound_update(object_t *pObj)
}
// --------------------------------------------------------------
void Patchmesh_init(object_t *pObj, UINT32 id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts)
void Patchmesh_init(object_t *pObj, uint32_t id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts)
{
patchmesh_t *pObject;
ri_var_t *pVar;
@@ -365,7 +365,7 @@ void Patchmesh_free(object_t *pObj)
void Patchmesh_get_patch(object_t *pObj, object_t *pDst, RtInt ip)
{
UINT32 i, j, k, npu, npv;
uint32_t i, j, k, npu, npv;
RtInt x1, y1;
patch_t *pPatch;
ri_var_t *pVar;
@@ -460,7 +460,7 @@ RtInt Patchmesh_get_npatches(object_t *pObj, RtInt *nupatches, RtInt *nvpatches)
void Patchmesh_bound_update(object_t *pObj)
{
UINT32 i, j, m, n, N;
uint32_t i, j, m, n, N;
patchmesh_t *pObject;
RtPoint *pPoints;
object_t *pMesh;
@@ -505,7 +505,7 @@ void Patchmesh_bound_update(object_t *pObj)
}
// --------------------------------------------------------------
void Sphere_init(object_t *pObj, UINT32 id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax)
void Sphere_init(object_t *pObj, uint32_t id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax)
{
sphere_t *pObject;
@@ -634,7 +634,7 @@ void Sphere_free(object_t *pObj)
}
// --------------------------------------------------------------
void Light_init(object_t *pObj, UINT32 id)
void Light_init(object_t *pObj, uint32_t id)
{
light_t *pObject;
+23 -23
View File
@@ -18,36 +18,36 @@ extern RtToken OBJECT_TYPE_CURVE;
// --------------------------------------------------------------
typedef struct _sstat_t
{
UINT32 num_polygons;
UINT32 num_patches;
UINT32 num_patchmeshes;
UINT32 num_lights;
UINT32 num_spheres;
UINT32 num_curves;
uint32_t num_polygons;
uint32_t num_patches;
uint32_t num_patchmeshes;
uint32_t num_lights;
uint32_t num_spheres;
uint32_t num_curves;
} stat_t;
typedef struct _sscene_t
{
stat_t stat;
UINT32 num_objs;
uint32_t num_objs;
linkedlist_t *pObjs;
} scene_t;
typedef struct _spolygon_t
{
UINT32 id;
UINT32 num_verts;
uint32_t id;
uint32_t num_verts;
} polygon_t;
typedef struct _scurve_t
{
UINT32 id;
uint32_t id;
RtToken type;
RtToken wrap;
UINT32 nverts;
uint32_t nverts;
RtFloat width[2];
RtPointer pVerts;
@@ -55,14 +55,14 @@ typedef struct _scurve_t
typedef struct _spatch_t
{
UINT32 id;
uint32_t id;
RtToken type;
} patch_t;
typedef struct _spatchmesh_t
{
UINT32 id;
uint32_t id;
RtInt nu, nv;
RtToken type;
RtToken uwrap, vwrap;
@@ -71,14 +71,14 @@ typedef struct _spatchmesh_t
typedef struct _slight_t
{
UINT32 id;
uint32_t id;
RtBoolean onoff;
} light_t;
typedef struct _ssphere_t
{
UINT32 id, is_full_sweep;
uint32_t id, is_full_sweep;
RtFloat radius, zmin, zmax;
RtFloat phi_min, phi_max, theta_max;
@@ -95,8 +95,8 @@ typedef struct _sobj_stat_t
typedef struct _sobject_t
{
UINT32 id;
UINT32 main_context;
uint32_t id;
uint32_t main_context;
RtToken type;
void *pObjData;
RtMatrix *pXform;
@@ -108,32 +108,32 @@ typedef struct _sobject_t
} object_t;
void Polygon_init(object_t *pObj, UINT32 id, UINT32 nvertices);
void Polygon_init(object_t *pObj, uint32_t id, uint32_t nvertices);
void Polygon_free(object_t *pObj);
void Polygon_dice(object_t *pObj, RtInt npu, RtInt npv);
void Polygon_bound_update(object_t *pObj);
void Curve_init(object_t *pObj, UINT32 id, RtToken degree, RtInt nverts, RtToken wrap);
void Curve_init(object_t *pObj, uint32_t id, RtToken degree, RtInt nverts, RtToken wrap);
void Curve_free(object_t *pObj);
void Curve_bound_update(object_t *pObj);
void Patch_init(object_t *pObj, UINT32 id, RtToken type);
void Patch_init(object_t *pObj, uint32_t id, RtToken type);
void Patch_free(object_t *pObj);
void Patch_dice(object_t *pObj, RtInt npu, RtInt npv);
void Patch_bound_update(object_t *pObj);
void Patchmesh_init(object_t *pObj, UINT32 id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts);
void Patchmesh_init(object_t *pObj, uint32_t id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts);
void Patchmesh_free(object_t *pObj);
void Patchmesh_get_patch(object_t *pObj, object_t *pDst, RtInt ip);
RtInt Patchmesh_get_npatches(object_t *pObj, RtInt *nupatches, RtInt *nvpatches);
void Patchmesh_bound_update(object_t *pObj);
void Sphere_init(object_t *pObj, UINT32 id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax);
void Sphere_init(object_t *pObj, uint32_t id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax);
void Sphere_free(object_t *pObj);
void Sphere_dice(object_t *pObj, RtInt npu, RtInt npv);
void Sphere_bound_update(object_t *pObj);
void Light_init(object_t *pObj, UINT32 id);
void Light_init(object_t *pObj, uint32_t id);
void Light_free(object_t *pObj);
void Scene_Add(scene_t *pObj, object_t *pObject);
+37 -37
View File
@@ -24,15 +24,15 @@ int sgn(int x)
{
return (x>0)-(x<0);
}
typedef UINT32 point2D_t[2];
typedef uint32_t point2D_t[2];
typedef struct _spoint2Dz_t
{
UINT32 x, y;
uint32_t x, y;
double z;
} point2Dz_t;
UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pPixels)
uint32_t Bresenham(image_t *pIm, color_t cs, uint32_t *P0, uint32_t *P1, point2D_t *pPixels)
#define JMIN(a,b) ((a)<(b)?(a):(b))
#define JMAX(a,b) ((a)>(b)?(a):(b))
@@ -42,7 +42,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP
/*--------------------------------------------------------------
* Bresenham-Algorithmus: Linien auf Rastergeräten zeichnen
* Bresenham-Algorithmus: Linien auf Rastergerten zeichnen
*
* Eingabeparameter:
* P0 = Koordinaten des Startpunkts
@@ -54,7 +54,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP
*---------------------------------------------------------------
*/
{
UINT32 count;
uint32_t count;
int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
@@ -86,7 +86,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP
if(dx<0) dx = -dx;
if(dy<0) dy = -dy;
/* feststellen, welche Entfernung größer ist */
/* feststellen, welche Entfernung grer ist */
if (dx>dy)
{
/* x ist schnelle Richtung */
@@ -141,7 +141,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP
void RenderWire_polygon(render_t *pObj, object_t *pObject)
{
RtMatrix world2cam;
UINT32 i, j, cnt;
uint32_t i, j, cnt;
rgba_t cs = {0}, cs_first;
polygon_t *pPoly;
RtPoint *pVerts;
@@ -149,7 +149,7 @@ void RenderWire_polygon(render_t *pObj, object_t *pObject)
point2D_t *pPxl;
RtFloat d[4], uv[2], p[4], dn;
UINT32 b[2], b_first[2], b_prev[2];
uint32_t b[2], b_first[2], b_prev[2];
pPxl = (point2D_t*)malloc((pObj->pImage->im_height+pObj->pImage->im_width)*sizeof(point2D_t));
@@ -187,8 +187,8 @@ void RenderWire_polygon(render_t *pObj, object_t *pObject)
dn = (RtFloat)(1.0/d[2]);
uv[0] = pObj->ku*d[0]*dn;
uv[1] = pObj->kv*d[1]*dn;
b[0] = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5));
b[1] = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5));
b[0] = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5));
b[1] = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5));
if (i > 0)
{
cnt = Bresenham(pObj->pImage, cs, b_prev, b, pPxl);
@@ -216,14 +216,14 @@ void RenderWire_polygon(render_t *pObj, object_t *pObject)
void RenderGridPoints(render_t *pObj, object_t *pObject)
{
UINT32 i;
uint32_t i;
RtMatrix world2cam;
rgba_t cs = {1,1,1,1};
RtPoint *pPoint;
RtColor *pColor;
RtFloat d[4], uv[2], p[4], dn;
UINT32 b[2];
uint32_t b[2];
MultiplyMatrices(pObj->pG->pXform->space[camera_space], *pObject->pXform, &world2cam);
i=0;
@@ -244,16 +244,16 @@ void RenderGridPoints(render_t *pObj, object_t *pObject)
dn = (RtFloat)(1.0/d[2]);
uv[0] = pObj->ku*d[0]*dn;
uv[1] = pObj->kv*d[1]*dn;
b[0] = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5));
b[1] = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5));
b[0] = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5));
b[1] = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5));
ImageSetPixel(pObj->pImage, b[0], b[1], cs);
}
}
typedef struct _sedge_t
{
INT32 xa, xb, ya, yb;
INT32 xmin, xmax, ymin, ymax;
int32_t xa, xb, ya, yb;
int32_t xmin, xmax, ymin, ymax;
RtFloat mi, b;
double za, zb, dz;
} edge_t;
@@ -264,9 +264,9 @@ typedef struct _sactive_edge_t
} active_edge_t;
void edge_sort(edge_t *pEdges, edge_t **ppEdges, UINT32 nedges)
void edge_sort(edge_t *pEdges, edge_t **ppEdges, uint32_t nedges)
{
UINT32 swapped, i;
uint32_t swapped, i;
void *pTmp;
for (i=0; i < nedges; i++)
@@ -291,8 +291,8 @@ void edge_sort(edge_t *pEdges, edge_t **ppEdges, UINT32 nedges)
void RenderGridPatchesFilled(render_t *pObj, object_t *pObject)
{
UINT32 i, j, x, y, cnt, ii, jj, win, swapped, offset;
INT32 ymin, ymax, xmin, xmax, ys, xs, tmp;
uint32_t i, j, x, y, cnt, ii, jj, win, swapped, offset;
int32_t ymin, ymax, xmin, xmax, ys, xs, tmp;
RtMatrix world2cam;
rgba_t cs = {1,1,1,1};
@@ -398,8 +398,8 @@ void RenderGridPatchesFilled(render_t *pObj, object_t *pObject)
dn = (RtFloat)1/z;
uv[0] = pObj->ku*(*ppVert[j])[0]*dn;
uv[1] = pObj->kv*(*ppVert[j])[1]*dn;
pPxl[j].x = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5));
pPxl[j].y = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5));
pPxl[j].x = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5));
pPxl[j].y = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5));
pPxl[j].z = z;
}
@@ -598,7 +598,7 @@ void RenderGridPatchesFilled(render_t *pObj, object_t *pObject)
void RenderGridPatches(render_t *pObj, object_t *pObject)
{
UINT32 i, j, x, y, cnt, offset;
uint32_t i, j, x, y, cnt, offset;
RtMatrix world2cam;
rgba_t cs = {1,1,1,1};
RtPoint *pPoint, *ppVert[4], *pPx;
@@ -609,7 +609,7 @@ void RenderGridPatches(render_t *pObj, object_t *pObject)
edge_t edges[4];
RtFloat d[4], uv[2], p[4], dn;
UINT32 b[2], b_first[2], b_prev[2];
uint32_t b[2], b_first[2], b_prev[2];
double z, z_first, z_prev, dz, zn;
double tictoc;
@@ -704,8 +704,8 @@ void RenderGridPatches(render_t *pObj, object_t *pObject)
dn = (RtFloat)1/z;
uv[0] = pObj->ku*(*ppVert[j])[0]*dn;
uv[1] = pObj->kv*(*ppVert[j])[1]*dn;
b[0] = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5));
b[1] = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5));
b[0] = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5));
b[1] = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5));
if (j > 0)
{
cnt = Bresenham(pObj->pImage, cs, b_prev, b, pPxl);
@@ -751,7 +751,7 @@ void Render_calc_pixel_coverage(render_t *pObj, object_t *pObject, RtFloat *nx,
RtMatrix world2cam;
RtFloat xmin, xmax, ymin, ymax;
RtFloat d[4], uv[2], p[4], dn;
UINT32 i;
uint32_t i;
RtPoint pVerts[8];
@@ -809,7 +809,7 @@ void Render_calc_pixel_coverage(render_t *pObj, object_t *pObject, RtFloat *nx,
void RenderBound(render_t *pObj, object_t *pObject)
{
RtMatrix world2cam;
UINT32 i;
uint32_t i;
rgba_t cs = {0};
polygon_t *pPoly;
RtPoint *pVerts;
@@ -922,15 +922,15 @@ void RenderBound(render_t *pObj, object_t *pObject)
void Render_patchmesh(render_t *pObj, object_t *pObject)
{
UINT32 i, j, m, n, M, N;
uint32_t i, j, m, n, M, N;
object_t patch;
RtFloat nx, ny;
Patchmesh_bound_update(pObject);
Render_calc_pixel_coverage(pObj, pObject, &nx, &ny);
M = (UINT32)(nx/pObject->pAttr->shadingrate);
N = (UINT32)(ny/pObject->pAttr->shadingrate);
M = (uint32_t)(nx/pObject->pAttr->shadingrate);
N = (uint32_t)(ny/pObject->pAttr->shadingrate);
Patchmesh_get_npatches(pObject, &m, &n);
@@ -955,7 +955,7 @@ void Render_patchmesh(render_t *pObj, object_t *pObject)
void Render_sphere(render_t *pObj, object_t *pObject)
{
UINT32 i, j, M, N;
uint32_t i, j, M, N;
RtFloat nx, ny, ngx, ngy;
Sphere_bound_update(pObject);
@@ -963,8 +963,8 @@ void Render_sphere(render_t *pObj, object_t *pObject)
ngx = nx / 16;
ngy = ny / 16;
M = (UINT32)(PI*ny/pObject->pAttr->shadingrate);
N = (UINT32)(1.42*nx/pObject->pAttr->shadingrate);
M = (uint32_t)(PI*ny/pObject->pAttr->shadingrate);
N = (uint32_t)(1.42*nx/pObject->pAttr->shadingrate);
Sphere_dice(pObject, M, N);
#ifdef RENDER_POINTS
@@ -978,15 +978,15 @@ void Render_sphere(render_t *pObj, object_t *pObject)
void Render_patch(render_t *pObj, object_t *pObject)
{
UINT32 i, j, M, N;
uint32_t i, j, M, N;
object_t patch, *pObject2;
RtFloat nx, ny;
Patch_bound_update(pObject);
Render_calc_pixel_coverage(pObj, pObject, &nx, &ny);
M = (UINT32)(nx/pObject->pAttr->shadingrate);
N = (UINT32)(ny/pObject->pAttr->shadingrate);
M = (uint32_t)(nx/pObject->pAttr->shadingrate);
N = (uint32_t)(ny/pObject->pAttr->shadingrate);
Patch_dice(pObject, M, N);
#ifdef RENDER_POINTS
+9 -9
View File
@@ -112,7 +112,7 @@ RtVoid RiEnd (void)
// --------------------------------------------------------------
RtVoid RiFrameBegin (RtInt number)
{
UINT32 i;
uint32_t i;
if (Engine_context_get(&engine, ENGINE_CONTEXT_LEVEL_MAIN) == ENGINE_CONTEXT_INVALID)
{
@@ -291,7 +291,7 @@ RtVoid RiTransformEnd (void)
// --------------------------------------------------------------
RtToken RiDeclare (char *name, char *declaration)
{
UINT32 i, len;
uint32_t i, len;
RtToken pVar;
char *pClass;
@@ -436,7 +436,7 @@ RtVoid RiSkew (RtFloat angle, RtFloat dx1, RtFloat dy1, RtFloat dz1,
// --------------------------------------------------------------
RtVoid RiTransform (RtMatrix transform)
{
UINT32 i, j;
uint32_t i, j;
GS_xform_push(pG);
@@ -636,7 +636,7 @@ RtVoid RiSides (RtInt nsides)
/* Geometric Primitives (and a couple gprim-specific attributes) */
RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...)
{
UINT32 j, v, n, k;
uint32_t j, v, n, k;
object_t *pObj;
RtToken token;
RtPoint *pPoint, *pVert;
@@ -652,7 +652,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...)
}
pObj = (object_t*)jmalloc(npolys*sizeof(object_t));
for (n=0; n < (UINT32)npolys; n++)
for (n=0; n < (uint32_t)npolys; n++)
{
Polygon_init(&pObj[n], ++pW->stat.num_polygons, nverts[n]);
}
@@ -664,7 +664,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...)
pPoint = (RtPoint*)va_arg(args, RtPointer);
v = 0;
for (n=0; n < (UINT32)npolys; n++)
for (n=0; n < (uint32_t)npolys; n++)
{
pVar = VarListFindByName(&engine.varList, token);
if (!pVar)
@@ -675,7 +675,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...)
pVar = VarListAdd(&pObj[n].vars, pVar);
pVert = (RtPoint*)VarSet(pVar, NULL, nverts[n]);
for (j=0; j < (UINT32)nverts[n]; j++)
for (j=0; j < (uint32_t)nverts[n]; j++)
{
k = verts[v++];
pVert[j][0] = pPoint[k][0];
@@ -685,7 +685,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...)
}
}
};
for (n=0; n < (UINT32)npolys; n++)
for (n=0; n < (uint32_t)npolys; n++)
{
Object_set_xform(&pObj[n], pG->pXform_curr);
Object_set_attr(&pObj[n], pG->pAttr);
@@ -759,7 +759,7 @@ RtVoid RiBasis (RtBasis ubasis, RtInt ustep, RtBasis vbasis, RtInt vstep)
RtVoid RiCurves (RtToken degree, RtInt ncurves, RtInt nverts[], RtToken wrap, ...)
{
UINT32 n;
uint32_t n;
object_t *pObj;
RtToken token;
RtPointer arg;
+12 -12
View File
@@ -15,7 +15,7 @@
// --------------------------------------------------------------
void RibgenPrintVars(engine_t *pObj, ri_var_t *pVar, RtPointer arg)
{
UINT32 i, j;
uint32_t i, j;
RtPoint *pPoint;
RtColor *pColor;
RtFloat *pFloat;
@@ -137,7 +137,7 @@ void Ribgen_TransformEnd(engine_t *pObj)
// --------------------------------------------------------------
void Ribgen_ConcatTransform(engine_t *pObj, RtMatrix transform)
{
UINT32 i, j;
uint32_t i, j;
if (!pObj->pFile)
return;
@@ -189,7 +189,7 @@ void Ribgen_Scale(engine_t *pObj, RtFloat dx, RtFloat dy, RtFloat dz)
// --------------------------------------------------------------
void Ribgen_Transform(engine_t *pObj, RtMatrix transform)
{
UINT32 i, j;
uint32_t i, j;
if (!pObj->pFile)
return;
@@ -346,7 +346,7 @@ void Ribgen_Illuminate (engine_t *pObj, RtInt id, RtBoolean onoff)
// --------------------------------------------------------------
void Ribgen_PointsPolygons(engine_t *pObj, RtInt npolys, RtInt *nverts, RtInt *verts, va_list args)
{
UINT32 j, v, n, num_verts = 0;
uint32_t j, v, n, num_verts = 0;
RtToken token;
RtPoint *pPoint;
@@ -362,17 +362,17 @@ void Ribgen_PointsPolygons(engine_t *pObj, RtInt npolys, RtInt *nverts, RtInt *v
pPoint = (RtPoint*)va_arg(args, RtPointer);
fprintf(pObj->pFile, " [");
for (n=0; n < (UINT32)npolys; n++)
for (n=0; n < (uint32_t)npolys; n++)
fprintf(pObj->pFile, " %d", nverts[n]);
fprintf(pObj->pFile, " ] [");
v = 0;
for (n=0; n < (UINT32)npolys; n++)
for (n=0; n < (uint32_t)npolys; n++)
{
for (j=0; j < (UINT32)nverts[n]; j++)
for (j=0; j < (uint32_t)nverts[n]; j++)
{
if ((UINT32)verts[v] > num_verts)
if ((uint32_t)verts[v] > num_verts)
num_verts = verts[v];
fprintf(pObj->pFile, " %d", verts[v]);
@@ -464,7 +464,7 @@ void Ribgen_Basis (engine_t *pObj, RtBasis ubasis, RtInt ustep, RtBasis vbasis,
// --------------------------------------------------------------
void Ribgen_Curves(engine_t *pObj, object_t *pObject, RtToken type, RtInt ncurves, RtInt nverts[], RtToken wrap, va_list args)
{
UINT32 i, n, num_verts = 0;
uint32_t i, n, num_verts = 0;
RtToken token;
RtPointer arg;
ri_var_t *pVar;
@@ -493,7 +493,7 @@ void Ribgen_Curves(engine_t *pObj, object_t *pObject, RtToken type, RtInt ncurve
// --------------------------------------------------------------
void Ribgen_Patch(engine_t *pObj, object_t *pObject, RtToken type, va_list args)
{
UINT32 i, npoints;
uint32_t i, npoints;
RtToken token;
RtPointer arg;
ri_var_t *pVar;
@@ -519,7 +519,7 @@ void Ribgen_Patch(engine_t *pObj, object_t *pObject, RtToken type, va_list args)
// --------------------------------------------------------------
void Ribgen_Patchmesh(engine_t *pObj, object_t *pObject, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, va_list args)
{
UINT32 i;
uint32_t i;
RtToken token;
RtPointer arg;
ri_var_t *pVar;
@@ -558,7 +558,7 @@ void Ribgen_Sphere(engine_t *pObj, object_t *pObject, RtFloat radius, RtFloat zm
}
// --------------------------------------------------------------
void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, UINT32 id, va_list args)
void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, uint32_t id, va_list args)
{
RtToken token;
RtPointer arg;
+1 -1
View File
@@ -35,7 +35,7 @@ void Ribgen_Curves(engine_t *pObj, object_t *pObject, RtToken type, RtInt ncurve
void Ribgen_Patch(engine_t *pObj, object_t *pObject, RtToken type, va_list args);
void Ribgen_Patchmesh(engine_t *pObj, object_t *pObject, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, va_list args);
void Ribgen_Sphere(engine_t *pObj, object_t *pObject, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax, va_list args);
void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, UINT32 id, va_list args);
void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, uint32_t id, va_list args);
void Ribgen_Surface(engine_t *pObj, char *name, va_list args);
void Ribgen_Displacement(engine_t *pObj, char *name, va_list args);
+1 -1
View File
@@ -42,7 +42,7 @@ stack_t* Stack_free(stack_t *pObj)
return pObj;
}
stack_t* Stack_push(stack_t *pObj, void **ppData, UINT32 size)
stack_t* Stack_push(stack_t *pObj, void **ppData, uint32_t size)
{
stack_t *pCurr;
+2 -2
View File
@@ -5,7 +5,7 @@
typedef struct _sstack_t
{
UINT32 size;
uint32_t size;
void *pData;
struct _sstack_t *pNext;
struct _sstack_t *pPrev;
@@ -14,7 +14,7 @@ typedef struct _sstack_t
stack_t* Stack_free_top(stack_t *pObj);
stack_t* Stack_free(stack_t *pObj);
stack_t* Stack_push(stack_t *pObj, void **ppData, UINT32 size);
stack_t* Stack_push(stack_t *pObj, void **ppData, uint32_t size);
stack_t* Stack_pop(stack_t *pObj, void **ppData);
#endif // STACK_H
+3 -23
View File
@@ -5,31 +5,11 @@
#ifndef TYPES_H
#define TYPES_H
#ifndef UINT32
#define UINT32 unsigned int
#endif
#ifndef UINT16
#define UINT16 unsigned short
#endif
#ifndef UINT8
#define UINT8 unsigned char
#endif
#ifndef INT32
#define INT32 signed int
#endif
#ifndef INT16
#define INT16 signed short
#endif
#ifndef INT8
#define INT8 signed char
#endif
#include <stdint.h>
#ifndef ERROR_BASE
#define ERROR_BASE 0x80000000
#endif
#ifndef IS_ERROR
#define IS_ERROR(e) ((e & ERROR_BASE) == ERROR_BASE)
#endif
+7 -7
View File
@@ -47,7 +47,7 @@ void VarListFree(var_list_t *pObj)
}
// finds variable by its name
ri_var_t* VarListFindByName(var_list_t *pObj, UINT8 *name)
ri_var_t* VarListFindByName(var_list_t *pObj, uint8_t *name)
{
linkedlist_t *pFirst, *pVarList;
ri_var_t *pVar;
@@ -105,12 +105,12 @@ void VarListPrint(var_list_t *pObj)
// Declare empty variable and add it to list of variables
ri_var_t* VarListDeclare(var_list_t *pObj, UINT8 *name, UINT8 *cls, UINT8 *type)
ri_var_t* VarListDeclare(var_list_t *pObj, uint8_t *name, uint8_t *cls, uint8_t *type)
{
RtToken *pToken;
RtInt *pSize;
UINT32 *pEtypes;
UINT32 *pEclasses;
uint32_t *pEtypes;
uint32_t *pEclasses;
ri_var_t var;
@@ -183,7 +183,7 @@ ri_var_t* VarListAdd(var_list_t *pObj, ri_var_t *pVar)
}
void VarListDelByName(var_list_t *pObj, UINT8 *name)
void VarListDelByName(var_list_t *pObj, uint8_t *name)
{
VarListDel(pObj, VarListFindByName(pObj, name));
}
@@ -214,7 +214,7 @@ void VarListDel(var_list_t *pObj, ri_var_t *pVar)
}
// Allocs empty variable
RtPointer VarAlloc(ri_var_t *pObj, UINT32 nvalues)
RtPointer VarAlloc(ri_var_t *pObj, uint32_t nvalues)
{
if (!nvalues)
return NULL;
@@ -235,7 +235,7 @@ RtPointer VarAlloc(ri_var_t *pObj, UINT32 nvalues)
}
// Allocs empty variable and copy data into it
RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, UINT32 nvalues)
RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, uint32_t nvalues)
{
RtPointer pData;
+10 -12
View File
@@ -1,19 +1,17 @@
#ifndef VARS_H
#define VARS_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
typedef struct _sri_var_t
{
UINT32 etype;
UINT32 ecls;
uint32_t etype;
uint32_t ecls;
RtToken name;
RtToken type;
RtToken cls;
RtPointer pValue;
UINT32 value_size, nvalues;
uint32_t value_size, nvalues;
} ri_var_t;
@@ -28,14 +26,14 @@ enum _vVarClass {VC_VERTEX, VC_UNIFORM, VC_VARYING, VC_CONSTANT};
void VarListInit(var_list_t *pObj);
void VarListFree(var_list_t *pObj);
ri_var_t* VarListFindByName(var_list_t *pObj, UINT8 *name);
ri_var_t* VarListDeclare(var_list_t *pObj, UINT8 *name, UINT8 *cls, UINT8 *type);
ri_var_t* VarListFindByName(var_list_t *pObj, uint8_t *name);
ri_var_t* VarListDeclare(var_list_t *pObj, uint8_t *name, uint8_t *cls, uint8_t *type);
ri_var_t* VarListAdd(var_list_t *pObj, ri_var_t *pVar);
void VarListDelByName(var_list_t *pObj, UINT8 *name);
void VarListDelByName(var_list_t *pObj, uint8_t *name);
void VarListDel(var_list_t *pObj, ri_var_t *pVar);
ri_var_t* VarListDeleteByName(var_list_t *pObj, UINT8 *name);
RtPointer VarAlloc(ri_var_t *pObj, UINT32 nvalues);
RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, UINT32 nvalues);
ri_var_t* VarListDeleteByName(var_list_t *pObj, uint8_t *name);
RtPointer VarAlloc(ri_var_t *pObj, uint32_t nvalues);
RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, uint32_t nvalues);
RtPointer VarGet(ri_var_t *pObj);
void VarListPrint(var_list_t *pObj);