📄 picking.hasm
字号:
;; @(#)picking.hasm 1.1 92/07/30 17:41:45;; Copyright (c) 1990 by Sun Microsystems, Inc.;#include "hasm_public.h"; This file tests highlight filter and picking.;; Draw 16 spheres with the help of matrix pushes and pops.;; This version has perspective and clips the spheres on all four; sides and in front. It also has fairly strong perspective.;; draw an area slightly bigger than pick box set_attribute hk_line_antialiasing .word FALSE set_attribute hk_line_geom_format .word HK_LINE_XYZ set_attribute hk_line_color .rgb <0.7, 0.7, 0.7> ; draw an area slightly bigger than pick box set_attribute hk_line_color .rgb <0.7, 0.7, 0.7> polyline 5 .xyz <-0.11, 0.85, 0.99> .xyz < 0.11, 0.85, 0.99> .xyz < 0.11, 0.95, 0.99> .xyz <-0.11, 0.95, 0.99> .xyz <-0.11, 0.85, 0.99> set_attribute hk_name_set .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;delete mask .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;delete mask .word 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;add mask .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;add mask set_attribute hk_pick_filter .word 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;inclusion mask .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;inclusion mask .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;exclusion mask .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;exclusion mask set_attribute hk_front_interior_style .word HK_POLYGON_SOLID set_attribute hk_back_interior_style .word HK_POLYGON_SOLID set_attribute hk_traversal_mode .word HK_RENDER jmpl enter, r2 set_attribute hk_traversal_mode .word HK_PICK_WITHOUT_RENDER set_attribute hk_pick_results_buffer .word pick_results_buffer set_attribute hk_clear_pick_results jmpl enter, r2 set_attribute hk_echo_svn .word 18 set_attribute hk_echo_en .word 5 set_attribute hk_echo_upick_id .word 300; .word 100 ; to verify no echoing. set_attribute hk_echo_type; .word HK_PICK_ECHO_EN; .word HK_PICK_ECHO_SVN .word HK_PICK_ECHO_SVN_WITH_UPICK_ID set_attribute hk_echo_color .rgb <1.0, 0.5, 0.0> set_attribute hk_traversal_mode .word HK_PICK_ECHO jmpl enter, r2 jmpl alldone, r2enter: push r2 set_attribute hk_load_lmt, @identity set_attribute hk_hsvn .word 1 set_attribute hk_upick_id .word 300 set_attribute hk_pick_box .xyz <-0.1, 0.86, 1.0> .xyz <0.1, 0.94, -1.0> set_attribute hk_line_geom_format .word 0 set_attribute hk_line_color .rgb <0.7, 0.7, 0.7> jps begin, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 pop r2 jmpl (r2+0), r2 ; Returnidentity: .dword 1.0, 0.0, 0.0, 0.0 .dword 0.0, 1.0, 0.0, 0.0 .dword 0.0, 0.0, 1.0, 0.0 .dword 0.0, 0.0, 0.0, 1.0begin: eps r3 .word 0, 0, 0, 0, 0, 0, 0, 0 set_attribute hk_cen .word 1 set_attribute hk_highlight_color .rgb <1.0, 0.0, 0.0> set_attribute hk_front_lighting_degree .word HK_SPECULAR_LIGHTING set_attribute hk_back_lighting_degree .word HK_SPECULAR_LIGHTING set_attribute hk_view .fword 0.0, 0.0, 1.0, 1.0 .matrix_pair \ ; VT and IVT < < 1.0, 0.0, 0.0, 0.0 > , \ < 0.0, 1.0, 0.0, 0.0 > , \ < 0.0, 0.0, 0.3, -0.3 > , \ < 0.0, 0.0, 0.0, 1.0 > > set_attribute hk_load_lmt .translate < 0.0, 0.0, 1.54 > set_attribute hk_pre_concat_lmt .scale 0.55; set_attribute hk_light_mask .word 0xffffffff ; Delete .word 0x00000000 ; Add; set_attribute hk_light_source, @light0; set_attribute hk_light_source, @light1; set_attribute hk_light_source, @light2; set_attribute hk_light_mask .word 0x00000000 ; Delete .word 0x00000007 ; Add; set_attribute hk_use_back_props .word TRUE set_attribute hk_face_culling_mode .word HK_CULL_NONE; set_attribute hk_front_material_properties .word 0.2 ; Ambient .word 0.8 ; Diffuse .word 1.0 ; Specular .word 20.0 ; Specular exponent set_attribute hk_front_specular_color .rgb <1.0, 1.0, 1.0> set_attribute hk_front_transparency_degree .word 1.0 set_attribute hk_back_material_properties .word 0.2 ; Ambient .word 0.8 ; Diffuse .word 1.0 ; Specular .word 20.0 ; Specular exponent set_attribute hk_front_specular_color .rgb <1.0, 1.0, 1.0> set_attribute hk_front_transparency_degree .word 1.0; set_attribute hk_front_surface_color .rgb < 0.1, 1.0, 0.1 > set_attribute hk_back_surface_color .rgb < 1.0, 0.3, 0.1 >; jps start, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 rps ;return ;light0: .word 0 ; Light number 0 .word HK_AMBIENT_LIGHT_SOURCE ; Light type .rgb < 0.3, 0.3, 0.3 > ; Light color .xyz < 0.0, 0.0, 0.0 > ; Light position .xyz < 0.0, 0.0, 1.0 > ; Light direction .word 1.0 ; spotlight power .word 1.0 ; Attenuation 1 .word 1.0 ; Attenuation 2 .word 0.0 ; Spotlight angle light1: .word 1 ; Light number 1 .word HK_DIRECTIONAL_LIGHT_SOURCE ; Light type .rgb < 1.0, 0.8, 1.0 > ; Light color .xyz < 0.0, 0.0, 0.0 > ; Light position .xyz < -0.25, 0.3, 0.15 > ; Light direction .word 1.0 ; spotlight power .word 1.0 ; Attenuation 1 .word 1.0 ; Attenuation 2 .word 0.0 ; Spotlight angle light2: .word 2 ; Light number 2 .word HK_DIRECTIONAL_LIGHT_SOURCE ; Light type .rgb < 1.0, 1.0, 0.8 > ; Light color .xyz < 0.0, 0.0, 0.0 > ; Light position .xyz < 0.5, 0.1, 0.10 > ; Light direction .word 1.0 ; spotlight power .word 1.0 ; Attenuation 1 .word 1.0 ; Attenuation 2 .word 0.0 ; Spotlight angle ;;; Make room for 16 spheres on the screenstart: eps r3 .word 0, 0, 0, 0, 0, 0, 0, 0 set_attribute hk_name_set .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;delete mask .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;delete mask .word 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;add mask .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;add mask set_attribute hk_pre_concat_lmt, @scale_one_fourth; Start at the top set_attribute hk_pre_concat_lmt, @up_two jps four_spheres, r3 .word 0, 0, 0, 0, 0, 0, 0, 0; set_attribute hk_pre_concat_lmt, @down_one; jps four_spheres, r3; .word 0, 0, 0, 0, 0, 0, 0, 0; set_attribute hk_pre_concat_lmt, @down_one; jps four_spheres, r3; .word 0, 0, 0, 0, 0, 0, 0, 0; set_attribute hk_pre_concat_lmt, @down_one; jps four_spheres, r3; .word 0, 0, 0, 0, 0, 0, 0, 0; rps ;returnfour_spheres: eps r3 .word 0, 0, 0, 0, 0, 0, 0, 0 push_state .word HKST0_CMT|HKST0_LMT|HKST0_GMT .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 set_attribute hk_cen .word 1 set_attribute hk_pre_concat_lmt, @left_two jps sphere, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 set_attribute hk_cen .word 2 set_attribute hk_pre_concat_lmt, @right_one jps sphere, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 set_attribute hk_cen .word 3 set_attribute hk_pre_concat_lmt, @right_one jps sphere, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 set_attribute hk_cen .word 4 set_attribute hk_pre_concat_lmt, @right_one jps sphere, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 pop_state .word HKST0_CMT|HKST0_LMT|HKST0_GMT .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 rps ; Returnscale_one_fourth: .scale 0.25 left_two: .translate < -3.0, 0.0, 0.0 > up_two: .translate < 0.0, 3.0, 0.0 > right_one: .translate < 2.0, 0.0, 0.0 > down_one: .translate < 0.0, -2.0, 0.0 >;; draw a sphere with 10 vertices per 90 degrees;sphere: eps r3 .word 0, 0, 0, 0, 0, 0, 0, 0 push_state .word HKST0_CMT|HKST0_LMT|HKST0_GMT .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 set_attribute hk_cen .word 1 jps half_sphere, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 set_attribute hk_cen .word 2 set_attribute hk_pre_concat_lmt, @swap_180 jps half_sphere, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 pop_state .word HKST0_CMT|HKST0_LMT|HKST0_GMT .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 rps ; Returnswap_180: .matrix \ < <-1.0, 0.0, 0.0, 0.0 > , \ < 0.0, 1.0, 0.0, 0.0 > , \ < 0.0, 0.0,-1.0, 0.0 > , \ < 0.0, 0.0, 0.0, 1.0 > >half_sphere: eps r3 .word 0, 0, 0, 0, 0, 0, 0, 0 push_state .word HKST0_CMT|HKST0_LMT|HKST0_GMT .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 .word 0x00000000 jps eighth_sphere, r3 .word 0, 0, 0, 0, 0, 0, 0, 0 set_attribute hk_pre_concat_lmt, @rot_90
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -