VRML编程练习

VRML编程练习

第一弹:IndexedLineSet线集合
注:学习阶段,不喜勿喷!
编译软件:VrmlPad

**
线集合语法:

IndexedLineSet{
	coord	Coordinate {
		point [          #里面存放各个顶点,顶点编号从0开始依次相加
			
		]
	}
	coordIndex [         #里面指出哪些点连成一条直线
		
	]
	color Color	{
		color [ 		#里面给出颜色,每个颜色用,分隔开,颜色数目和线段数目相同
			
		]
	}
	colorIndex [ 		#给出线段编号对应上面的颜色
	]
	colorPerVertex     #指明着色方式是基于端点还是基于线段(TRUE/FALSE),默认基于端点(TRUE)    
}

示例代码

**

#VRML V2.0 utf8

Shape {
	appearance Appearance {}
	geometry IndexedLineSet	{
		coord  Coordinate {
			point [
				0 0 0,        #index=0
				1 0 0,        #index=1
				1 -0.5 0.75,  #index=2
				0 -0.5 0.75,  #index=3
				0 -1.5 0.75,  #index=4
				1 -1.5 0.75,  #index=5
				1 -2.5 0.75,  #index=6
				0 -2.5 0.75,  #index=7
				0 -3.0 1.5,   #index=8
				1 -3.0 1.5,   #index=9	
			]
		}
		coordIndex [
			0 1 2 3 0 -1,
			2 3 4 5 2 -1,
			4 5 6 7 4 -1,
			6 7 8 9 6 -1,
		]
		color Color	{
			color [
				1 1 1,
				1 1 1,
				1 1 1,
				1 1 1,
			]
		}
		colorIndex [0 1 2 3]
		colorPerVertex FALSE
	}
}

**

运行效果展示

**
在这里插入图片描述

  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

_码到成功_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值