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;
查看全文
相关阅读:
google-glog 开源库分析(一):glog介绍
homebrew用法
macos新手入门
markdown语法_文本效果[转载]
markdown语法[转载]
从Search Sort到Join
实际例子描述和分析“猎豹抢票跨站推荐功能有票刷不到”的疑似bug
最简单例子图解JVM内存分配和回收
B树在数据库索引中的应用剖析
从Count看Oracle执行计划的选择
原文地址:https://www.cnblogs.com/len3d/p/655844.html
最新文章
安装centos6.4分区时提示sda必须有一个GPT磁盘标签
Linux测试端口是否可用
Linux查找大文件 (find的用法)
Linux安装7za
Linux如何清除缓存
Linux如何关闭分区journal日志
第133讲:Hadoop集群监控Ganglia架构设计和运行机制详细解析学习笔记
第132讲:Hadoop集群监控:日志、Metrics学习笔记
第131讲:Hadoop集群管理工具均衡器Balancer 实战详解学习笔记
第130讲:Hadoop集群管理工具DataBlockScanner 实战详解学习笔记
热门文章
第129讲:Hadoop集群管理工具fsck实战详解学习笔记
第128讲:Hadoop集群管理工具dfsadmin实战详解学习笔记
第127讲:Hadoop集群管理之安全模式解析及动手实战学习笔记
第126讲:Hadoop集群管理之Datanode目录元数据结构详解学习笔记
第125讲:Hadoop集群管理之SecondaryNamenode目录元数据结构详解及其内幕机制学习笔记
第124讲:Hadoop集群管理之fsimage和edits工作机制内幕详解学习笔记
发现编程范型一:认识范型
google-glog 开源库分析(四):glog宏技巧
google-glog 开源库分析(三):glog核心类结构
google-glog 开源库分析(二):glog用法
Copyright © 2011-2022 走看看