📄 m_translate.c
字号:
#define DEST_4FC trans_1_GLint_4fc_raw
#define DEST_1UB trans_1_GLint_1ub_raw
#define DEST_1UI trans_1_GLint_1ui_raw
#include "m_trans_tmp.h"
#undef SRC
#undef SRC_IDX
#undef TRX_3F
#undef TRX_4F
#undef TRX_4FC
#undef TRX_UB
#undef TRX_US
#undef TRX_UI
/* GL_UNSIGNED_INT
*/
#define SRC GLuint
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT)
#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) )
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) )
#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) )
#define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24)
#define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16)
#define TRX_UI(f,n) PTR_ELT(f,n)
#define SZ 4
#define INIT init_trans_4_GLuint_raw
#define DEST_4F trans_4_GLuint_4f_raw
#define DEST_4FC trans_4_GLuint_4fc_raw
#define DEST_4UB trans_4_GLuint_4ub_raw
#define DEST_4US trans_4_GLuint_4us_raw
#include "m_trans_tmp.h"
#define SZ 3
#define INIT init_trans_3_GLuint_raw
#define DEST_4F trans_3_GLuint_4f_raw
#define DEST_4FC trans_3_GLuint_4fc_raw
#define DEST_4UB trans_3_GLuint_4ub_raw
#define DEST_4US trans_3_GLuint_4us_raw
#define DEST_3F trans_3_GLuint_3f_raw
#include "m_trans_tmp.h"
#define SZ 2
#define INIT init_trans_2_GLuint_raw
#define DEST_4F trans_2_GLuint_4f_raw
#define DEST_4FC trans_2_GLuint_4fc_raw
#include "m_trans_tmp.h"
#define SZ 1
#define INIT init_trans_1_GLuint_raw
#define DEST_4F trans_1_GLuint_4f_raw
#define DEST_4FC trans_1_GLuint_4fc_raw
#define DEST_1UB trans_1_GLuint_1ub_raw
#define DEST_1UI trans_1_GLuint_1ui_raw
#include "m_trans_tmp.h"
#undef SRC
#undef SRC_IDX
#undef TRX_3F
#undef TRX_4F
#undef TRX_4FC
#undef TRX_UB
#undef TRX_US
#undef TRX_UI
/* GL_DOUBLE
*/
#define SRC GLdouble
#define SRC_IDX TYPE_IDX(GL_DOUBLE)
#define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n)
#define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n)
#define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n)
#define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n))
#define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n))
#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n)
#define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n)
#define SZ 4
#define INIT init_trans_4_GLdouble_raw
#define DEST_4F trans_4_GLdouble_4f_raw
#define DEST_4FC trans_4_GLdouble_4fc_raw
#define DEST_4UB trans_4_GLdouble_4ub_raw
#define DEST_4US trans_4_GLdouble_4us_raw
#include "m_trans_tmp.h"
#define SZ 3
#define INIT init_trans_3_GLdouble_raw
#define DEST_4F trans_3_GLdouble_4f_raw
#define DEST_4FC trans_3_GLdouble_4fc_raw
#define DEST_4UB trans_3_GLdouble_4ub_raw
#define DEST_4US trans_3_GLdouble_4us_raw
#define DEST_3F trans_3_GLdouble_3f_raw
#include "m_trans_tmp.h"
#define SZ 2
#define INIT init_trans_2_GLdouble_raw
#define DEST_4F trans_2_GLdouble_4f_raw
#define DEST_4FC trans_2_GLdouble_4fc_raw
#include "m_trans_tmp.h"
#define SZ 1
#define INIT init_trans_1_GLdouble_raw
#define DEST_4F trans_1_GLdouble_4f_raw
#define DEST_4FC trans_1_GLdouble_4fc_raw
#define DEST_1UB trans_1_GLdouble_1ub_raw
#define DEST_1UI trans_1_GLdouble_1ui_raw
#define DEST_1F trans_1_GLdouble_1f_raw
#include "m_trans_tmp.h"
#undef SRC
#undef SRC_IDX
/* GL_FLOAT
*/
#define SRC GLfloat
#define SRC_IDX TYPE_IDX(GL_FLOAT)
#define SZ 4
#define INIT init_trans_4_GLfloat_raw
#define DEST_4UB trans_4_GLfloat_4ub_raw
#define DEST_4US trans_4_GLfloat_4us_raw
#define DEST_4F trans_4_GLfloat_4f_raw
#define DEST_4FC trans_4_GLfloat_4fc_raw
#include "m_trans_tmp.h"
#define SZ 3
#define INIT init_trans_3_GLfloat_raw
#define DEST_4F trans_3_GLfloat_4f_raw
#define DEST_4FC trans_3_GLfloat_4fc_raw
#define DEST_4UB trans_3_GLfloat_4ub_raw
#define DEST_4US trans_3_GLfloat_4us_raw
#define DEST_3F trans_3_GLfloat_3f_raw
#include "m_trans_tmp.h"
#define SZ 2
#define INIT init_trans_2_GLfloat_raw
#define DEST_4F trans_2_GLfloat_4f_raw
#define DEST_4FC trans_2_GLfloat_4fc_raw
#include "m_trans_tmp.h"
#define SZ 1
#define INIT init_trans_1_GLfloat_raw
#define DEST_4F trans_1_GLfloat_4f_raw
#define DEST_4FC trans_1_GLfloat_4fc_raw
#define DEST_1UB trans_1_GLfloat_1ub_raw
#define DEST_1UI trans_1_GLfloat_1ui_raw
#define DEST_1F trans_1_GLfloat_1f_raw
#include "m_trans_tmp.h"
#undef SRC
#undef SRC_IDX
#undef TRX_3F
#undef TRX_4F
#undef TRX_4FC
#undef TRX_UB
#undef TRX_US
#undef TRX_UI
static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4],
CONST void *Ptr,
GLuint stride,
ARGS )
{
const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride;
GLuint i;
if (((((uintptr_t) f | (uintptr_t) stride)) & 3L) == 0L) {
/* Aligned.
*/
for (i = DST_START ; i < n ; i++, f += stride) {
COPY_4UBV( t[i], f );
}
} else {
for (i = DST_START ; i < n ; i++, f += stride) {
t[i][0] = f[0];
t[i][1] = f[1];
t[i][2] = f[2];
t[i][3] = f[3];
}
}
}
static void init_translate_raw(void)
{
MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) );
MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) );
MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) );
MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) );
MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) );
MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) );
MEMSET( TAB(_4fc), 0, sizeof(TAB(_4fc)) );
init_trans_4_GLbyte_raw();
init_trans_3_GLbyte_raw();
init_trans_2_GLbyte_raw();
init_trans_1_GLbyte_raw();
init_trans_1_GLubyte_raw();
init_trans_3_GLubyte_raw();
init_trans_4_GLubyte_raw();
init_trans_4_GLshort_raw();
init_trans_3_GLshort_raw();
init_trans_2_GLshort_raw();
init_trans_1_GLshort_raw();
init_trans_4_GLushort_raw();
init_trans_3_GLushort_raw();
init_trans_2_GLushort_raw();
init_trans_1_GLushort_raw();
init_trans_4_GLint_raw();
init_trans_3_GLint_raw();
init_trans_2_GLint_raw();
init_trans_1_GLint_raw();
init_trans_4_GLuint_raw();
init_trans_3_GLuint_raw();
init_trans_2_GLuint_raw();
init_trans_1_GLuint_raw();
init_trans_4_GLdouble_raw();
init_trans_3_GLdouble_raw();
init_trans_2_GLdouble_raw();
init_trans_1_GLdouble_raw();
init_trans_4_GLfloat_raw();
init_trans_3_GLfloat_raw();
init_trans_2_GLfloat_raw();
init_trans_1_GLfloat_raw();
TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw;
}
#undef TAB
#ifdef CLASS
#undef CLASS
#endif
#undef ARGS
#undef CHECK
#undef SRC_START
#undef DST_START
#undef NEXT_F
#undef NEXT_F2
void _math_init_translate( void )
{
init_translate_raw();
}
void _math_trans_1f(GLfloat *to,
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint start,
GLuint n )
{
_math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
}
void _math_trans_1ui(GLuint *to,
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint start,
GLuint n )
{
_math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
}
void _math_trans_1ub(GLubyte *to,
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint start,
GLuint n )
{
_math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
}
void _math_trans_4ub(GLubyte (*to)[4],
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint size,
GLuint start,
GLuint n )
{
_math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
}
void _math_trans_4chan( GLchan (*to)[4],
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint size,
GLuint start,
GLuint n )
{
#if CHAN_TYPE == GL_UNSIGNED_BYTE
_math_trans_4ub( to, ptr, stride, type, size, start, n );
#elif CHAN_TYPE == GL_UNSIGNED_SHORT
_math_trans_4us( to, ptr, stride, type, size, start, n );
#elif CHAN_TYPE == GL_FLOAT
_math_trans_4fc( to, ptr, stride, type, size, start, n );
#endif
}
void _math_trans_4us(GLushort (*to)[4],
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint size,
GLuint start,
GLuint n )
{
_math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
}
void _math_trans_4f(GLfloat (*to)[4],
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint size,
GLuint start,
GLuint n )
{
_math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
}
void _math_trans_4fc(GLfloat (*to)[4],
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint size,
GLuint start,
GLuint n )
{
_math_trans_4fc_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
}
void _math_trans_3f(GLfloat (*to)[3],
CONST void *ptr,
GLuint stride,
GLenum type,
GLuint start,
GLuint n )
{
_math_trans_3f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -