⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lighting_shading.hasm

📁 操作系统SunOS 4.1.3版本的源码
💻 HASM
📖 第 1 页 / 共 2 页
字号:
;;      @(#)lighting_shading.hasm 1.1 92/07/30 17:41:38;; Copyright (c) 1990 by Sun Microsystems, Inc.;#include "hasm_public.h";; 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.;	set_attribute	hk_view	.fword		-0.5,  0.5,  0.5,  0.5	.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_front_lighting_degree	.word		HK_SPECULAR_LIGHTING	set_attribute	hk_back_lighting_degree	.word		HK_SPECULAR_LIGHTING	set_attribute	hk_load_lmt	.translate	< 0.0, 0.0, 0.0 >	set_attribute	hk_pre_concat_lmt	.scale		0.95;	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 >	; Specular color	set_attribute	hk_front_transparency_degree	.word		1.0			; Transparency coefficient	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 >	; Specular color	set_attribute	hk_front_transparency_degree	.word		1.0			; Transparency coefficient;	set_attribute	hk_front_surface_color	.rgb		< 0.0, 1.0, 0.0 >	set_attribute	hk_back_surface_color	.rgb		< 1.0, 0.0, 0.0 >	set_attribute	hk_front_hatch_style, @hatch1	set_attribute	hk_back_hatch_style, @hatch2	set_attribute	hk_transparency_quality	.word		HK_SCREEN_DOOR	set_attribute	hk_transparency_mode	.word		HK_OPAQUE_VISIBLE;	jmpl		start, r2;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	.norm		< 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 anglelight1:	.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	.norm		< -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 anglelight2:	.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	.norm		< 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:	set_attribute	hk_pre_concat_lmt, @scale_one_fourth; Start at the top	set_attribute	hk_pre_concat_lmt, @up_two	jmpl		four_spheres, r2	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 >	; Specular color	set_attribute	hk_front_transparency_degree	.word		0.50			; Transparency coefficient	set_attribute	hk_pre_concat_lmt, @down_one	jmpl		four_spheres, r2	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 >	; Specular color	set_attribute	hk_front_transparency_degree	.word		1.0			; Transparency coefficient	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_back_specular_color	.rgb		< 1.0, 1.0, 1.0 >	; Specular color	set_attribute	hk_back_transparency_degree	.word		0.50			; Transparency coefficient	set_attribute	hk_pre_concat_lmt, @down_one	jmpl		four_spheres, r2	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 >	; Specular color	set_attribute	hk_front_transparency_degree	.word		0.50			; Transparency coefficient	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_back_specular_color	.rgb		< 1.0, 1.0, 1.0 >	; Specular color	set_attribute	hk_back_transparency_degree	.word		0.50			; Transparency coefficient	set_attribute	hk_pre_concat_lmt, @down_one	jmpl		four_spheres, r2;	trap		0			; Exithatch1:	.word		TRUE	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0	.word		0x0000f0f0hatch2:	.word		TRUE	.word		0x0000ffff	.word		0x0000ffff	.word		0x0000ffff	.word		0x0000ffff	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x0000ffff	.word		0x0000ffff	.word		0x0000ffff	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x0000ffff	.word		0x0000ffff	.word		0x0000ffff	.word		0x00000000	.word		0x00000000	.word		0x00000000four_spheres:	push		r2	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_front_interior_style	.word		HK_POLYGON_SOLID	set_attribute	hk_back_interior_style	.word		HK_POLYGON_SOLID	set_attribute	hk_front_shading_method	.word		HK_SHADING_FLAT	set_attribute	hk_back_shading_method	.word		HK_SHADING_FLAT	set_attribute	hk_pre_concat_lmt, @left_two	jmpl		sphere, r2	set_attribute	hk_front_interior_style	.word		HK_POLYGON_SOLID	set_attribute	hk_back_interior_style	.word		HK_POLYGON_SOLID	set_attribute	hk_front_shading_method	.word		HK_SHADING_GOURAUD	set_attribute	hk_back_shading_method	.word		HK_SHADING_GOURAUD	set_attribute	hk_pre_concat_lmt, @right_one	jmpl		sphere, r2	set_attribute	hk_front_interior_style	.word		HK_POLYGON_SOLID	set_attribute	hk_back_interior_style	.word		HK_POLYGON_HATCHED	set_attribute	hk_pre_concat_lmt, @right_one	jmpl		sphere, r2	set_attribute	hk_front_interior_style	.word		HK_POLYGON_HATCHED	set_attribute	hk_back_interior_style	.word		HK_POLYGON_HATCHED	set_attribute	hk_pre_concat_lmt, @right_one	jmpl		sphere, r2	pop_state	.word		HKST0_CMT|HKST0_LMT|HKST0_GMT	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	pop		r2	jmpl		(r2+0),r2	; Returnscale_one_fourth:	.scale		0.25left_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:	push		r2	push_state	.word		HKST0_CMT|HKST0_LMT|HKST0_GMT	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	jmpl		half_sphere, r2	set_attribute	hk_pre_concat_lmt, @swap_180	jmpl		half_sphere, r2	pop_state	.word		HKST0_CMT|HKST0_LMT|HKST0_GMT	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	pop		r2	jmpl		(r2+0),r2	; 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:	push		r2	push_state	.word		HKST0_CMT|HKST0_LMT|HKST0_GMT	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000	.word		0x00000000

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -