Converted TranslatePoint to C.

This commit is contained in:
Steven Fuller 2003-05-21 03:38:50 +00:00 committed by Patryk Obara
parent 877a2f9b7c
commit d0484e7829
3 changed files with 16 additions and 11 deletions

View file

@ -4396,7 +4396,7 @@ extern void TranslationSetup(void)
}
#if 0
#ifndef LINUX
#ifndef _MSC_VER
void TranslatePoint(int *source, int *dest, int *matrix);
#pragma aux TranslatePoint = \
@ -4496,6 +4496,13 @@ void TranslatePoint(int *source, int *dest, int *matrix)
}
#endif
#else /* LINUX */
static void TranslatePoint(const float *source, float *dest, const float *matrix)
{
dest[0] = matrix[ 0] * source[0] + matrix[ 1] * source[1] + matrix[ 2] * source[2] + matrix[ 3];
dest[1] = matrix[ 4] * source[0] + matrix[ 5] * source[1] + matrix[ 6] * source[2] + matrix[ 7];
dest[2] = matrix[ 8] * source[0] + matrix[ 9] * source[1] + matrix[10] * source[2] + matrix[11];
}
#endif
void TranslatePointIntoViewspace(VECTORCH *pointPtr)

View file

@ -94,8 +94,6 @@ extern int FindHeatSourcesInHModel(DISPLAYBLOCK *dispPtr);
extern void TranslationSetup(void);
extern void TranslatePointIntoViewspace(VECTORCH *pointPtr);
void TranslatePoint(float *source, float *dest, float *matrix);
extern void CheckRenderStatesForModule(MODULE *modulePtr);

View file

@ -209,22 +209,22 @@ int CMP_LL(LONGLONGCH *a, LONGLONGCH *b)
llgs:
}
*/
#if 0
int retval;
/* TODO */
#if 1
int retval;
__asm__("movl 0(%%ebx), %%eax \n\t"
"movl 4(%%ebx), %%edx \n\t"
"subl 0(%%ecx), %%eax \n\t"
"sbbl 4(%%ecx), %%edx \n\t"
"xorl %%ebx, %%ebx \n\t"
"andl %%edx, %%edx \n\t"
"jne 0 \n\t" /* llnz */
"jne 0f \n\t" /* llnz */
"andl %%eax, %%eax \n\t"
"je 1 \n" /* llgs */
"je 1f \n" /* llgs */
"0: \n\t" /* llnz */
"movl $1, %%ebx \n\t"
"andl %%edx, %%edx \n\t"
"jge 1 \n\t" /* llgs */
"jge 1f \n\t" /* llgs */
"negl %%ebx \n"
"1: \n\t" /* llgs */
: "=b" (retval)
@ -628,10 +628,9 @@ __asm__ volatile
#endif
}
#if 0 // SBF - converted to C in kshape.c
void TranslatePoint(float *source, float *dest, float *matrix)
{
// fprintf(stderr, "TranslatePoint(%f, %f, %f)\n");
/* TODO - implement the inline assembly here? */
/* Moved it to a separate file because I can't figure out the damn syntax! */
/* This is currently not inlined for testing */
@ -640,3 +639,4 @@ __asm__("call TranslatePoint_Asm \n\t"
: "S" (source), "b" (dest), "D" (matrix)
);
}
#endif