📄 hidden_surface_removal.hasm
字号:
;; @(#)hidden_surface_removal.hasm 1.1 92/07/30 17:41:09;; Copyright (c) 1990 by Sun Microsystems, Inc.;#include "hasm_public.h"#define LOOP_COUNT 20 ; Number circles to draw.#define START_RADIUS 0.1 ; Radius of the first circle.#define X_START 0.05 ; start position in x#define X_TRANS 0.05 ; 1.0/TIMES#define GROWTH 1.2;;;start:; Back surface properties (independent from front) set_attribute hk_use_back_props .word FALSE; Draw the standard solid triangles set_attribute hk_front_interior_style .word HK_POLYGON_SOLID set_attribute hk_back_interior_style .word HK_POLYGON_SOLID; This can override interior_style... set_attribute hk_front_general_style .word HK_POLYGON_SOLID .word 0 set_attribute hk_back_general_style .word HK_POLYGON_SOLID .word 0; no lighting set_attribute hk_front_lighting_degree .word HK_NO_LIGHTING set_attribute hk_back_lighting_degree .word HK_NO_LIGHTING set_attribute hk_z_buffer_compare, #TRUE set_attribute hk_z_buffer_update, #TRUE set_attribute hk_front_shading_method .word HK_SHADING_GOURAUD set_attribute hk_back_shading_method .word HK_SHADING_GOURAUD set_attribute hk_front_material_properties .fword 1.0 ; Ambient .fword 1.0 ; Diffuse .fword 1.0 ; Specular .fword 20.0 ; Specular exponent set_attribute hk_back_material_properties .fword 1.0 ; Ambient .fword 1.0 ; Diffuse .fword 1.0 ; Specular .fword 20.0 ; Specular exponent; Display both front and back-facing triangles set_attribute hk_face_culling_mode .word HK_CULL_NONE; Use screen-door transparency when surface properties are transparent set_attribute hk_transparency_quality .word HK_SCREEN_DOOR set_attribute hk_tri_geom_format .word HK_TRI_XYZ_FNORMAL set_attribute hk_pre_concat_lmt .translate < 1.0, 0.0, 0.0 > set_attribute hk_pre_concat_lmt .scale START_RADIUS ld #20, r0 ld #color, r2 set_attribute hk_back_surface_color .rgb <1.0, 1.0, 1.0>loop: set_attribute hk_front_surface_color, (r2 + 0) jmpl circle, r6 addi #12, r2 subi #1, r0 bleg r0, all_done, all_done, continuecontinue: set_attribute hk_pre_concat_lmt .translate < -0.1, 0.0, -0.1 > set_attribute hk_pre_concat_lmt .scale GROWTH jmpl loop, r6all_done: trap 0color:; color #0 .fword 0.94858082 .fword 0.71522698 .fword 0.92566673; color #1 .fword 0.11920259 .fword 0.82555707 .fword 0.45309336; color #2 .fword 0.46965682 .fword 0.31593208 .fword 0.81366777; color #3 .fword 0.79486552 .fword 0.28025339 .fword 0.15779161; color #4 .fword 0.03679324 .fword 0.37417738 .fword 0.80895909; color #5 .fword 0.06242305 .fword 0.11128587 .fword 0.15915429; color #6 .fword 0.12263814 .fword 0.15706747 .fword 0.90502284; color #7 .fword 0.46484183 .fword 0.33293518 .fword 0.84279194; color #8 .fword 0.23402107 .fword 0.61846069 .fword 0.91560913; color #9 .fword 0.03205577 .fword 0.56086638 .fword 0.65371998; color #10 .fword 0.27348353 .fword 0.50944720 .fword 0.36894696; color #11 .fword 0.19915027 .fword 0.62864979 .fword 0.19450404; color #12 .fword 0.05224363 .fword 0.09830661 .fword 0.91043611; color #13 .fword 0.99591140 .fword 0.09317212 .fword 0.09068950; color #14 .fword 0.62370302 .fword 0.92996536 .fword 0.16486689; color #15 .fword 0.43266211 .fword 0.99238841 .fword 0.27615275; color #16 .fword 0.59181640 .fword 0.11502655 .fword 0.43322023; color #17 .fword 0.09683924 .fword 0.97986838 .fword 0.06615541; color #18 .fword 0.33963117 .fword 0.81388945 .fword 0.38461610; color #19 .fword 0.25524030 .fword 0.84594522 .fword 0.94548248circle: push r6 push_state .word HKST0_CMT|HKST0_LMT|HKST0_GMT .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 jmpl quarter_circle, r6 set_attribute hk_pre_concat_lmt .rotate_z -90 jmpl quarter_circle, r6 set_attribute hk_pre_concat_lmt .rotate_z -90 jmpl quarter_circle, r6 set_attribute hk_pre_concat_lmt .rotate_z -90 jmpl quarter_circle, r6 pop_state .word HKST0_CMT|HKST0_LMT|HKST0_GMT .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 pop r6 jmpl (r6+0),r6 ; Returnquarter_circle: triangle_list 11 .tri_start_ccw .xyz < 0.000000, 0.000000, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.500000, 0.000000, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.492404, 0.086824, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.469846, 0.171010, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.433013, 0.250000, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.383022, 0.321394, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.321394, 0.383022, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.250000, 0.433013, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.171010, 0.469846, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.086824, 0.492404, 0.000000 > .norm < 0, 0, 1 > .tri_r2 .xyz < 0.000000, 0.500000, 0.000000 > .norm < 0, 0, 1 > jmpl (r6+0),r6 ; Return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -