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;
查看全文
相关阅读:
StackStorm简介及其部署
Nginx系列(十二)——性能调整
Nginx系列(十一)——通过日志进行故障排查
Nginx系列(十)——可用性监控进阶
Nginx系列(九)——容器/微服务
Nginx系列(八)——数字媒体流
Nginx系列(七)——HTTP/2
Nginx系列(六)——安全控制
Nginx系列(五)——认证
Nginx系列(四)——配置文件自动化管理
原文地址:https://www.cnblogs.com/len3d/p/655844.html
最新文章
【面经】Epic: 数据库去重
2014 Hangjs 见闻流水账第二天
2014 Hangjs 见闻流水账第一天
用node开发repl应用
Hello Kraken.js!
Gradle 构建 android 应用常见问题解决指南
Grunt 新手指南
用node-webkit 开发 PC 客户端
重构博客园Android App
用Pomelo 搭建一个简易的推送平台
热门文章
运维工程师职业技能汇总大全(持续更新)
Centos8和Centos7实际使用区别
MySQL生产环境常见架构
MySQL常见故障汇总
MySQL事务中的redo与undo
腾讯云-TCE容器服务快速上手
Apache httpd server部署
Nginx平滑升级
MySQL5.7配置SSL加密
自动化运维平台Bigops部署
Copyright © 2011-2022 走看看