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;
查看全文
相关阅读:
[LeetCode] 17. Letter Combinations of a Phone Number 电话号码的字母组合
[LeetCode] 11. Container With Most Water 装最多水的容器
[LeetCode] 42. Trapping Rain Water 收集雨水
Meta标签中的format-detection属性及含义(转)
html marquee 标签(转)
css 样式引入的方法 link 与import的区别
html meta标签使用
backface-visibility
zepto.js 总结
HTTP 请求的组成 方法 已经 请求的状态码
原文地址:https://www.cnblogs.com/len3d/p/655844.html
最新文章
字符串与C51的格式化输出
code与const void*指针
散转程序与软复位
菜单
[转载]Linux网络编程IPv4和IPv6的inet_addr、inet_aton、inet_pton等函数小结
理解mcelog如何工作
linux时钟管理
errno的基本用法
漫谈-中断
ps查看内存占用排序
热门文章
Linux内存点滴 用户进程内存空间
shell中eval命令妙用——变量嵌套替换
[系统资源攻略]CPU
[LeetCode] 44. Wildcard Matching 外卡匹配
[LeetCode] 22. Generate Parentheses 生成括号
[LeetCode] 32. Longest Valid Parentheses 最长有效括号
[LeetCode] 20. Valid Parentheses 合法括号
[LeetCode] 454. 4Sum II 四数之和II
[LeetCode] 18. 4Sum 四数之和
[LeetCode] 283. Move Zeroes 移动零
Copyright © 2011-2022 走看看