zoukankan
html css js c++ java
Building a flexiable renderer
typedef union _Vector2f
{
struct
{
float
x, y; }
;
struct
{
float
u, v; }
;
float
arr[
2
];
FORCEINLINE
void
init()
{
x
=
y
=
0.0f
;
}
FORCEINLINE
void
init(
float
_x,
float
_y )
{
x
=
_x; y
=
_y;
}
}
Vector2f;
typedef union _Vector3f
{
struct
{
float
x, y, z; }
;
struct
{
float
r, g, b; }
;
float
arr[
3
];
FORCEINLINE
void
init()
{
x
=
y
=
z
=
0.0f
;
}
FORCEINLINE
void
init(
float
_x,
float
_y,
float
_z )
{
x
=
_x; y
=
_y; z
=
_z;
}
}
Vector3f;
typedef union _Vector4f
{
struct
{
float
x, y, z, w; }
;
struct
{
float
r, g, b, a; }
;
struct
{ Vector3f abc;
float
d; }
;
struct
{ Vector2f uv;
float
du, dv; }
;
float
arr[
4
];
__m128 mm;
FORCEINLINE
void
init()
{
x
=
y
=
z
=
0.0f
; w
=
1.0f
;
}
FORCEINLINE
void
init(
float
_x,
float
_y,
float
_z )
{
x
=
_x; y
=
_y; z
=
_z; w
=
1.0f
;
}
FORCEINLINE
void
init(
float
_x,
float
_y,
float
_z,
float
_w )
{
x
=
_x; y
=
_y; z
=
_z; w
=
_w;
}
}
Vector4f;
typedef union _Vector2i
{
struct
{
int
x, y; }
;
int
arr[
2
];
}
Vector2i;
typedef union _Vector3i
{
struct
{
int
x, y, z; }
;
struct
{
int
r, g, b; }
;
int
arr[
3
];
}
Vector3i;
typedef union _Vector4i
{
struct
{
int
x, y, z, w; }
;
struct
{
int
r, g, b, a; }
;
int
arr[
4
];
}
Vector4i;
typedef union _Vector2b
{
struct
{ BYTE x, y; }
;
BYTE arr[
2
];
}
Vector2b;
typedef union _Vector3b
{
struct
{ BYTE x, y, z; }
;
struct
{ BYTE r, g, b; }
;
BYTE arr[
3
];
}
Vector3b;
typedef union _Vector4b
{
struct
{ BYTE x, y, z, w; }
;
struct
{ BYTE r, g, b, a; }
;
BYTE arr[
4
];
}
Vector4b;
typedef union _Matrix33f
{
struct
{
float
m1, m2, m3,
m4, m5, m6,
m7, m8, m9; }
;
float
arr[
9
];
float
m[
3
][
3
];
}
Matrix33f;
typedef union _Matrix44f
{
struct
{
float
m1, m2, m3, m4,
m5, m6, m7, m8,
m9, m10, m11, m12,
m13, m14, m15, m16; }
;
struct
{
float
rs[
12
]; Vector4f translation; }
;
float
arr[
16
];
float
m[
4
][
4
];
__m128 mm[
4
];
Vector4f v[
4
];
}
Matrix44f;
typedef union _Rect4i
{
struct
{
int
left, right, top, bottom; }
;
int
arr[
4
];
}
Rect4i;
typedef union _Rect6i
{
struct
{
int
left, right, top, bottom,
width, height; }
;
int
arr[
6
];
}
Rect6i;
typedef union _Rect4f
{
struct
{
float
xmin, xmax, ymin, ymax; }
;
float
arr[
4
];
}
Rect4f;
typedef union _Rect6f
{
struct
{
float
xmin, xmax, ymin, ymax,
width, height; }
;
float
arr[
6
];
}
Rect6f;
typedef union _Range2f
{
struct
{
float
min, max; }
;
float
arr[
2
];
FORCEINLINE
bool
cover(
float
_s )
const
{
if
( _s
>=
min
&&
_s
<=
max )
return
true
;
else
return
false
;
}
}
Range2f;
typedef union _Bound6f
{
struct
{
float
xmin, xmax, ymin, ymax, zmin, zmax; }
;
struct
{ Range2f xrange, yrange, zrange; }
;
Range2f range[
3
];
float
arr[
6
];
FORCEINLINE
void
operator
+=
(
const
_Bound6f
&
b )
{
if
( xmin
>
b.xmin ) xmin
=
b.xmin;
if
( xmax
<
b.xmax ) xmax
=
b.xmax;
if
( ymin
>
b.ymin ) ymin
=
b.ymin;
if
( ymax
<
b.ymax ) ymax
=
b.ymax;
if
( zmin
>
b.zmin ) zmin
=
b.zmin;
if
( zmax
<
b.zmax ) zmax
=
b.zmax;
}
FORCEINLINE
void
operator
+=
(
const
Vector3f
&
v )
{
if
( xmin
>
v.x ) xmin
=
v.x;
if
( xmax
<
v.x ) xmax
=
v.x;
if
( ymin
>
v.y ) ymin
=
v.y;
if
( ymax
<
v.y ) ymax
=
v.y;
if
( zmin
>
v.z ) zmin
=
v.z;
if
( zmax
<
v.z ) zmax
=
v.z;
}
FORCEINLINE
void
operator
=
(
const
Vector3f
&
v )
{
xmax
=
xmin
=
v.x;
ymax
=
ymin
=
v.y;
zmax
=
zmin
=
v.z;
}
}
Bound6f;
typedef union _Bound9f
{
struct
{
float
xmin, xmax, ymin, ymax, zmin, zmax,
width, height, length; }
;
struct
{ Bound6f box;
float
width, height, length; }
;
float
arr[
9
];
FORCEINLINE
void
normalize()
{
width
=
xmax
-
xmin;
height
=
ymax
-
ymin;
length
=
zmax
-
zmin;
}
}
Bound9f;
查看全文
相关阅读:
Grid如何固定列宽?
ORACLE 去除重复记录
Ajax学习之“一头雾水”
对对碰方块交换及消去效果实现
存储过程学习(二)
asp.net 页面重用问题
一个图表控件
存储过程学习(一)
ScriptManager.RegisterClientScriptBlock的疑问
用indy做发贴机
原文地址:https://www.cnblogs.com/len3d/p/655844.html
最新文章
权限,动态判断,真的会把代码,越写越乱
PHP date 和 time
"#ifdef 语句1 程序2 #endif“
记录一下,数据库连接,高级写法
export default
关于thinkphp,前端向后端传递参数的那些事
vue,mounted
关于昨天加班的事
using $this when not in object context
checkbox 的全选功能
热门文章
Oracle 存储过程中使用cursor 游标遍历数据
C# 中访问URL之乱码问题解决
SQL WITH NOCHECK
SVN 文档提交时过期报错
oracle 中随机取一条记录的两种方法
SQL SERVER批量插入相同的数据懒人方法
GridView中列的绑定与显示问题
一个通用的数据库类
C# 查看本机端口的可用情况
web游戏
Copyright © 2011-2022 走看看