1 / 34

X3D 教程

X3D 教程. 掌握 X3D 第三节. 主要内容:坐标确定形状. 掌握 X3D 第三节. 点 PointSet. PointSet 三维点 Coordinate 坐标 point 指定点坐标 Color 颜色 color 设置颜色值. 掌握 X3D 第三节. <Shape> <PointSet> <Coordinate point="2 2 0,2 2 3,3 0 -2"/> <Color color="1 0 0,0 0 1,0 1 0"/> </PointSet> </Shape>. 掌握 X3D 第三节.

Download Presentation

X3D 教程

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. X3D教程

  2. 掌握X3D 第三节 主要内容:坐标确定形状

  3. 掌握X3D 第三节 点PointSet • PointSet 三维点 • Coordinate 坐标 • point 指定点坐标 • Color 颜色 • color 设置颜色值

  4. 掌握X3D 第三节 • <Shape> • <PointSet> • <Coordinate point="2 2 0,2 2 3,3 0 -2"/> • <Color color="1 0 0,0 0 1,0 1 0"/> • </PointSet> • </Shape>

  5. 掌握X3D 第三节 线IndexedLineSet • IndexedLineSet线段 • coodIndex 连点顺序,其中-1表示线段结束

  6. 掌握X3D 第三节 • 添加一条线 • <Shape> • <IndexedLineSet coordIndex="0 1"> • <Coordinate point="0 4.0 0.0 ,2.0 0.0 2.0"/> • </IndexedLineSet> • </Shape>

  7. 掌握X3D 第三节 • 两条线 • <Shape> • <IndexedLineSet coordIndex="0 1 2"> • <Coordinate point="0 4.0 0.0 ,2.0 0.0 2.0,0 2 0"/> • </IndexedLineSet> • </Shape>

  8. 掌握X3D 第三节 • 另外的两条线 • <Shape> • <IndexedLineSet coordIndex="0 1 -1 0 2"> • <Coordinate point="0 4.0 0.0 ,2.0 0.0 2.0,0 2 0"/> • </IndexedLineSet> • </Shape>

  9. 掌握X3D 第三节 • <Shape> • <IndexedLineSet coordIndex=" 0 1 -1 0 2 -1 0 3 -1 0 4 -1 1 2 3 4 1 -1"> • <Coordinate point=" 0 3 0 ,3 0 3,3 0 -3 ,-3 0 -3 ,-3 0 3"/> • </IndexedLineSet> • </Shape> 3 2 4 1

  10. 掌握X3D 第三节 • 设置颜色 • <Appearance> • <Material emissiveColor="1 1 0"/> • </Appearance>

  11. 掌握X3D 第三节 三角面IndexedTriangleStripSet • TriangleStripSet 三角面 • index 点连接顺序 • 子节点 • Coordinate 坐标 • Color 设置颜色

  12. 掌握X3D 第三节 • 一个三角形 • <Shape> • <IndexedTriangleStripSet index="0 1 2"> • <Coordinate point="0 0 0,0 1 0,0 0 1"/> • </IndexedTriangleStripSet> • </Shape>

  13. 掌握X3D 第三节 • 一个梯形 • <Shape> • <IndexedTriangleStripSet index="0 1 2,2 3 1"> • <Coordinate point="-1 1 0,1 1 0,-2 -1 0,2 -1 0"/> • </IndexedTriangleStripSet> • </Shape> • 0 1 • 2 3

  14. 掌握X3D 第三节 • 部分看不见? • solid 属性为true 時,多面体的面会因为视角而被遮挡。 • Solid为 false 时,不会遮挡。 • <IndexedTriangleStripSet index="0 1 2,2 3 1" solid ="false">

  15. 掌握X3D 第三节 • 四面体 • <Shape> • <IndexedTriangleStripSet index="0 1 2,0 1 3,0 2 3,1 2 3"> • <Coordinate point="0 0 0,0 1 0,0 0 1,1 0 0"/> • </IndexedTriangleStripSet> • </Shape> 1 0 3 2

  16. 掌握X3D 第三节 Color • 各点颜色 • <Shape> • <IndexedTriangleStripSet index="0 1 2,0 1 3,0 2 3,1 2 3"> • <Coordinate point="0 0 0,0 1 0,0 0 1,1 0 0"/> • <Color color="1 0 0,0.5 0 0,0.3 0.5 0,0.5 1 0"/> • </IndexedTriangleStripSet> • </Shape>

  17. 掌握X3D 第三节 颜色面 • <Shape> • <IndexedTriangleStripSet index="0 1 2"> • <Coordinate point="0 0 0,0 1 0,0 0 1"/> • <Color color="1 1 0,1 1 0,1 1 0,"/> • </IndexedTriangleStripSet> • </Shape> • <Shape> • <IndexedTriangleStripSet index="0 1 2"> • <Coordinate point="0 1 0,0 0 1,1 0 0"/> • <Color color="0 0 1,0 0 1,0 0 1"/> • </IndexedTriangleStripSet> • </Shape>

  18. 掌握X3D 第三节 例子:梯体 • 坐标设定+下平面 • <Shape> • <IndexedTriangleStripSet index="0 1 2 3 1" solid ="false"> • <Coordinate point="-2 0 2,2 0 2 ,-2 0 -2 ,2 0 -2,-3 2 3,3 2 3 ,-3 2 -3 ,3 2 -3"/> </IndexedTriangleStripSet> • </Shape> 4 5 6 7 0 1 2 3

  19. 掌握X3D 第三节 • 上平面 • <IndexedTriangleStripSet index="0 1 2 3 1,4 5 6 7 5" solid ="false"> • 侧面1 • <IndexedTriangleStripSet index="0 1 2 3 1,4 5 6 7 5,3 1 7 5 1" solid ="false"> • 3 1 • 7 5

  20. 掌握X3D 第三节 • 侧面2 • <IndexedTriangleStripSet index="0 1 2 3 1,4 5 6 7 5,3 1 7 5 1,1 0 5 4 0" solid ="false"> • 1 0 • 5 4

  21. 掌握X3D 第三节 • 同理可得侧面3和侧面4 • <IndexedTriangleStripSet index="0 1 2 3 1,4 5 6 7 5,3 1 7 5 1,1 0 5 4 0,0 2 4 6 2, 2 3 6 7 3" solid ="false">

  22. 掌握X3D 第三节 世博中国馆外观 • 颜色 • <Color color="1 0 0,1 0 0,1 0 0,1 0 0,1 0 0,1 0 0,1 0 0,1 0 0"/>

  23. 掌握X3D 第三节 • 长方体1 • <Transform translation ="-1 -1 1"> • <Shape> • <Appearance> • <Material diffuseColor="1 0.2 0.3" /> • </Appearance> • <Box size="0.7 2 0.7"/> • </Shape> • </Transform>

  24. 掌握X3D 第三节 • 同理可得另外3个长方体 • <Transform translation ="1 -1 1"> • <Shape> • <Appearance> • <Material diffuseColor="1 0.2 0.3" /> • </Appearance> • <Box size="0.7 2 0.7"/> • </Shape> • </Transform>

  25. 掌握X3D 第三节 • <Transform translation ="1 -1 -1"> • <Shape> • <Appearance> • <Material diffuseColor="1 0.2 0.3" /> • </Appearance> • <Box size="0.7 2 0.7"/> • </Shape> • </Transform> • <Transform translation ="-1 -1 -1"> • <Shape> • <Appearance> • <Material diffuseColor="1 0.2 0.3" /> • </Appearance> • <Box size="0.7 2 0.7"/> • </Shape> • </Transform>

  26. 掌握X3D 第三节 面IndexedFaceSet • IndexedFaceSet表示由点构成的多面体

  27. 掌握X3D 第三节 • <Shape> • <Appearance> • <Material diffuseColor="1 0 0" /> • </Appearance> • <IndexedFaceSet coordIndex="0 1 2 3 1 -1,4 5 6 7 5 -1"> • <Coordinate point="-2 0 2,2 0 2 ,-2 0 -2 ,2 0 -2,-3 2 3,3 2 3 ,-3 2 -3 ,3 2 -3" /> • </IndexedFaceSet> • </Shape>

  28. 掌握X3D 第三节 • <Shape> • <Appearance> • <Material diffuseColor="1 0 0" emissiveColor="0 1 0" specularColor="1 1 0"/> • </Appearance> • <IndexedFaceSet coordIndex="0, 1, 2, 3, 4, 5, 6, -1, 0, 12, 11, 10, 9, 8, 7, -1, 0, 7, 1, -1, 1, 7, 8, 2, -1, 2, 8, 9, 3, -1, 3, 9, 10, 4, -1, 4, 10, 11, 5, -1, 5, 11, 12, 6, -1, 6, 12, 0"> • <Coordinate point="0.0 0.0 0.0, 5.5 5.0 0.88, 4.0 5.5 0.968, 7.0 8.0 1.408, 4.0 9.0 1.584, 1.0 5.0 0.88, 2.5 4.5 0.792, 5.5 5.0 -0.88, 4.0 5.5 -0.968, 7.0 8.0 -1.408, 4.0 9.0 -1.584, 1.0 5.0 -0.88, 2.5 4.5 -0.792,"/> • </IndexedFaceSet> • </Shape>

  29. 掌握X3D 第三节 格状矩形ElevationGrid • ElevationGrid 节点表示格状矩形 • xDimension x方向格数 • zDimension z方向格数 • Height 高度 • xSpacing x方向间隔距离 • zSpacing z方向间隔距离

  30. 掌握X3D 第三节 • <Shape> • <ElevationGrid height=" 2 1.2 -0.3 0.8 " xDimension="2" zDimension="2"/> • </Shape>

  31. 掌握X3D 第三节 • <Shape> • <Appearance> • <Material diffuseColor="0.2 0.4 0.6" emissiveColor="1 0 0" specularColor="0 0 1"/> • </Appearance> • <ElevationGrid • height=" 0.8 1.2 0.0 1.2 0.9 0.9 0.65 0.0 0.0 0.3 0.8 0.16 0.6 1.1 0.2 " xDimension="5" xSpacing="1.5" zDimension="3" zSpacing="2.0"/> • </Shape>

  32. 掌握X3D 第三节 纹理 • <Appearance> • <ImageTexture url="1.jpg"/> • </Appearance>

More Related