zoukankan
html css js c++ java
用内联汇编写的RT核心
__asm
{
;
152
: ray_dir
=
ray
->
dir;
;
153
:
;
154
: dot_nd
=
-
( normal.x
*
ray_dir.x
+
normal.y
*
ray_dir.y
+
normal.z
*
ray_dir.z );
xorps xmm3, xmm3 ;
mov ebx, dword ptr ray ;
mov edi, dword ptr state ;
mov esi, dword ptr
this
;
mov ecx, dword ptr [ebx]e_Ray.dir.x ;
mov edx, dword ptr [ebx]e_Ray.dir.y ;
mov eax, dword ptr [ebx]e_Ray.dir.z ;
movss xmm0, dword ptr [esi]
this
.normal.z ;
movss xmm1, dword ptr [esi]
this
.normal.y ;
prefetchnta
byte
ptr [esi
+
TYPE
this
] ;
mov dword ptr ray_dir.x, ecx ;
mov dword ptr ray_dir.y, edx ;
mulss xmm1, dword ptr ray_dir.y ;
mov dword ptr ray_dir.z, eax ;
mulss xmm0, dword ptr ray_dir.z ;
addss xmm0, xmm1 ;
movss xmm1, dword ptr [esi]
this
.normal.x ;
mulss xmm1, dword ptr ray_dir.x ;
;
156
: ray_src
=
ray
->
src;
mov edx, dword ptr [ebx]e_Ray.src.x ;
mov eax, dword ptr [ebx]e_Ray.src.y ;
mov ecx, dword ptr [ebx]e_Ray.src.z ;
addss xmm0, xmm1 ;
movaps xmm1, xmm3 ;
subss xmm1, xmm0 ;
;
158
:
if
( dot_nd
<=
0.0f
)
comiss xmm3, xmm1 ;
movss dword ptr dot_nd, xmm1 ;
mov dword ptr ray_src.x, edx ;
mov dword ptr ray_src.y, eax ;
mov dword ptr ray_src.z, ecx ;
;
159
:
return
false
;
jae RETURN_FALSE ;
;
161
: t
=
ray_src.x
*
normal.x
+
ray_src.y
*
normal.y
+
ray_src.z
*
normal.z
+
normal.w;
movss xmm7, dword ptr [esi]
this
.normal.z ;
mulss xmm7, dword ptr ray_src.z ;
movss xmm0, dword ptr [esi]
this
.normal.y ;
mulss xmm0, dword ptr ray_src.y ;
addss xmm7, xmm0 ;
movss xmm0, dword ptr [esi]
this
.normal.x ;
mulss xmm0, dword ptr ray_src.x ;
addss xmm7, xmm0 ;
addss xmm7, dword ptr [esi]
this
.normal.w ;
;
163
: t_near
=
ray
->
t_near;
movss xmm0, dword ptr [ebx]e_Ray.t_near ;
;
165
:
if
( t
<=
t_near
*
dot_nd )
mulss xmm0, xmm1 ;
comiss xmm0, xmm7 ;
movss dword ptr t, xmm7 ;
;
166
:
return
false
;
jae RETURN_FALSE ;
;
168
: t_far
=
MIN( ray
->
t_far, state
->
t );
movss xmm0, dword ptr [edi]e_RayState.t ;
comiss xmm0, dword ptr [ebx]e_Ray.t_far ;
jbe CASE_BELOW ;
movss xmm0, dword ptr [ebx]e_Ray.t_far ;
//
jmp FAR_TEST ;
CASE_BELOW:
//
movss xmm0, dword ptr [edi]e_RayState.t ;
//
FAR_TEST:
;
169
:
;
170
:
if
( t
>=
t_far
*
dot_nd )
mulss xmm0, xmm1 ;
comiss xmm7, xmm0 ;
;
171
:
return
false
;
jae RETURN_FALSE ;
;
177
: hit.arr[ projX ]
=
ray_src.arr[ projX ]
*
dot_nd
+
ray_dir.arr[ projX ]
*
t;
movzx eax,
byte
ptr [esi]
this
.projX ;
add eax, eax ;
add eax, eax ;
movss xmm0, dword ptr [ray_dir
+
eax] ;
movss xmm2, dword ptr [ray_src
+
eax] ;
mulss xmm0, xmm7 ;
mulss xmm2, xmm1 ;
addss xmm0, xmm2 ;
movss dword ptr [hit
+
eax], xmm0 ;
;
178
: hit.arr[ projY ]
=
ray_src.arr[ projY ]
*
dot_nd
+
ray_dir.arr[ projY ]
*
t;
movzx ecx,
byte
ptr [esi]
this
.projY ;
add ecx, ecx ;
add ecx, ecx ;
;
182
:
if
( inited
!=
TRUE )
//
cmp byte ptr [esi]this.inited, 1 ;
movss xmm0, dword ptr [ray_dir
+
ecx] ;
movss xmm2, dword ptr [ray_src
+
ecx] ;
mulss xmm0, xmm7 ;
mulss xmm2, xmm1 ;
addss xmm0, xmm2 ;
movss dword ptr [hit
+
ecx], xmm0 ;
//
je BARY_TEST ;
;
183
: prepare_intersect();
//
call prepare_intersect ;
//
BARY_TEST:
;
187
: bary.x
=
hit.arr[ projX ]
*
la.x
+
hit.arr[ projY ]
*
la.y
+
la.z
*
dot_nd;
movss xmm6, dword ptr [esi]
this
.la.y ;
mulss xmm6, dword ptr [hit
+
ecx] ;
movss xmm0, dword ptr [esi]
this
.la.z ;
lea ecx, dword ptr [hit
+
ecx] ;
mulss xmm0, xmm1 ;
addss xmm6, xmm0 ;
movss xmm0, dword ptr [esi]
this
.la.x ;
mulss xmm0, dword ptr [hit
+
eax] ;
lea eax, dword ptr [hit
+
eax] ;
addss xmm6, xmm0 ;
;
189
:
if
( bary.x
<
0.0f
||
bary.x
>
dot_nd )
comiss xmm3, xmm6 ;
ja RETURN_FALSE ;
comiss xmm6, xmm1 ;
ja RETURN_FALSE ;
;
192
: bary.y
=
hit.arr[ projX ]
*
lb.x
+
hit.arr[ projY ]
*
lb.y
+
lb.z
*
dot_nd;
movss xmm5, dword ptr [esi]
this
.lb.y ;
mulss xmm5, dword ptr [ecx] ;
movss xmm0, dword ptr [esi]
this
.lb.z ;
mulss xmm0, xmm1 ;
addss xmm5, xmm0 ;
movss xmm0, dword ptr [esi]
this
.lb.x ;
mulss xmm0, dword ptr [eax] ;
addss xmm5, xmm0 ;
;
194
:
if
( bary.y
<
0.0f
||
bary.y
>
dot_nd )
comiss xmm3, xmm5 ;
ja RETURN_FALSE ;
comiss xmm5, xmm1 ;
ja RETURN_FALSE ;
;
197
: bary.z
=
dot_nd
-
bary.x
-
bary.y;
movaps xmm4, xmm1 ;
subss xmm4, xmm6 ;
subss xmm4, xmm5 ;
;
199
:
if
( bary.z
<
0.0f
||
bary.z
>
dot_nd )
comiss xmm3, xmm4 ;
ja RETURN_FALSE ;
comiss xmm4, xmm1 ;
ja RETURN_FALSE ;
movss dword ptr bary.x, xmm6 ;
movss dword ptr bary.y, xmm5 ;
movss dword ptr bary.z, xmm4 ;
}
//
__asm
查看全文
相关阅读:
OLT配置学习
notepad配合正则表达式处理文本
利用expect和sshpass完美非交互性执行远端命令
yum 数据库报错与重构
杀死dialog
OLT配置说明
freeradius下发限速信息字段
debug调试日志和数据查询
通过windows的超级终端连接华为交换机
强制清除交换机端口所有配置
原文地址:https://www.cnblogs.com/len3d/p/817956.html
最新文章
HDU 5322 Hope ——NTT 分治 递推
HDU 5307 He is Flying ——FFT
BZOJ 4069 [Apio2015]巴厘岛的雕塑 ——贪心
BZOJ 3456 城市规划 ——NTT
BZOJ 4175 小G的电话本 ——NTT
BZOJ 3509 [CodeChef] COUNTARI ——分块 FFT
BZOJ 3771 Triple ——FFT
BZOJ 4070 [Apio2015]雅加达的摩天楼 ——分块 SPFA
BZOJ 3625 [Codeforces Round #250]小朋友和二叉树 ——NTT 多项式求逆 多项式开根
shell技巧
热门文章
数据库重建
yum离线安装
BGP&RIP
GPON命令模式
GPON介绍及华为OLT网关注册配置流程(转)
计费在线补丁指令
cacti安装和使用
yum search 不好用时
lspci能看到ifconfig -a看不到网卡
华为EPON OLT开局配置
Copyright © 2011-2022 走看看