Download presentation
Presentation is loading. Please wait.
Published byDana Cross Modified over 9 years ago
1
© TMC Computer School HC20203 VRML 3 - 1 HIGHER DIPLOMA IN COMPUTING Chapter 3 – Object Definition in VRML
2
© TMC Computer School HC20203 VRML 3 - 2 HIGHER DIPLOMA IN COMPUTING Building Primitive Shapes Each node may have the following characteristics A type name. Examples include Box, Color, Group, Sphere, Sound, or SpotLight Zero or more fields that define how each node differs from other nodes of the same type A set of events that it can receive and send An implementation A name The Shape node associates a geometry node with nodes that define that geometry's appearance
3
© TMC Computer School HC20203 VRML 3 - 3 HIGHER DIPLOMA IN COMPUTING Building Primitive Shapes Shape nodes must be part of the transformation hierarchy to have any visible result The transformation hierarchy must contain Shape nodes for any geometry to be visible A Shape node contains exactly one geometry node in its geometry field The appearance of a shape is being described y the Appearance and Material nodes Using the default values, we will be able to create shaded white shape These primitive shapes include Box, Cone, Cylinder and Sphere node
4
© TMC Computer School HC20203 VRML 3 - 4 HIGHER DIPLOMA IN COMPUTING The Shape Syntax All VRML shapes are built using the Shape node. The syntax of Shape node is as follows: Shape { appearance NULL # exposedfield SFNode geometry NULL # exposedField SFNode } The value of the geometry field specifies either a Box, Cone, Cylinder, and Sphere nodes The default NULL value for this field indicates the absence of geometry
5
© TMC Computer School HC20203 VRML 3 - 5 HIGHER DIPLOMA IN COMPUTING The Shape Syntax The appearance field specifies a node defining the appearance of the shape including its color and surface texture The default NULL indicates a glowing white appearance
6
© TMC Computer School HC20203 VRML 3 - 6 HIGHER DIPLOMA IN COMPUTING The Appearance and Material Node The Material node specifies material attributes as follows: Material { ambientIntensity 0.2# exposedfield SFFloat diffuseColor 0.8 0.8 0.8# exposedField SFColor emissiveColor0.0 0.0 0.0# exposedField SFColor shininess0.2# exposedField SFFloat specularColor0.0 0.0 0.0# exposedField SFColor transparency0.0# exposedField SFFloat }
7
© TMC Computer School HC20203 VRML 3 - 7 HIGHER DIPLOMA IN COMPUTING The Appearance and Material Node The Appearance node specifies appearance attributes as follows: Appearance { material NULL# exposedfield SFNode texture NULL# exposedField SFNode textureTransform NULL# exposedField SFNode } Note that the default values for the Material node create shaded white shapes
8
© TMC Computer School HC20203 VRML 3 - 8 HIGHER DIPLOMA IN COMPUTING The Cone Node The Cone node creates a cone-shaped primitive geometry and may be used as the value of the geometry field in the Shape node Cone { bottomRadius 1.0# field SFFloat height 2.0# field SFFloat sideTRUE# field SFBool bottomTRUE# field SFBool }
9
© TMC Computer School HC20203 VRML 3 - 9 HIGHER DIPLOMA IN COMPUTING The Cone Node The value of the bottomRadius specifies the radius of the bottom of a 3D cone centered at the origin The height specifies the cone’s height in the Y direction The side specifies whether or not the sloping sides of the once are built The bottom specifies whether or not the circular bottom of the cone is built
10
© TMC Computer School HC20203 VRML 3 - 10 HIGHER DIPLOMA IN COMPUTING The Cylinder Node The Cylinder node creates a cylinder-shaped primitive geometry and may be used as the value of the geometry field in the Shape node Cylinder { radius 1.0# field SFFloat height 2.0# field SFFloat sideTRUE# field SFBool topTRUE# fieldSFBool bottomTRUE# field SFBool }
11
© TMC Computer School HC20203 VRML 3 - 11 HIGHER DIPLOMA IN COMPUTING The Cylinder Node The value of the radius specifies the radius of 3D cylinder centered at the origin The height specifies the cylinder’s height in the Y direction The side specifies whether or not the curving sides of the cylinder are built The top specifies whether or not the circular top of the cylinder is built The bottom specifies whether or not the circular bottom of the cylinder is built
12
© TMC Computer School HC20203 VRML 3 - 12 HIGHER DIPLOMA IN COMPUTING The Sphere Node The Sphere node creates a sphere-shaped (a ball or globe) primitive geometry and may be used as the value of the geometry field in the Shape node Sphere { radius 1.0# field SFFloat } The value of the radius specifies the radius of the 3D sphere centered at the origin
13
© TMC Computer School HC20203 VRML 3 - 13 HIGHER DIPLOMA IN COMPUTING The Group Node The Group node is used to group VRML nodes together Group { children [ ]# exposedField MFNode bboxCenter 0.0 0.0 0.0# fieldSFVec3f bboxSize-1.0 -1.0 -1.0# fieldSFVec3f addChildren# eventInMFNode removeChildren# eventOutMFNode } The value of the children field specifies a list of child nodes to be included in the group. Typical children field include Shape nodes and other Group nodes. In this course, we will not be covering the rest of the fields
14
© TMC Computer School HC20203 VRML 3 - 14 HIGHER DIPLOMA IN COMPUTING Default Box #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } }
15
© TMC Computer School HC20203 VRML 3 - 15 HIGHER DIPLOMA IN COMPUTING Box with Dimension #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Box { size 1.0 3.0 5.0 }
16
© TMC Computer School HC20203 VRML 3 - 16 HIGHER DIPLOMA IN COMPUTING Default Cone #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Cone { } }
17
© TMC Computer School HC20203 VRML 3 - 17 HIGHER DIPLOMA IN COMPUTING Cone with Dimension #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Cone { bottomRadius 3.5 height 1.5 }
18
© TMC Computer School HC20203 VRML 3 - 18 HIGHER DIPLOMA IN COMPUTING Default Cylinder #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Cylinder { } }
19
© TMC Computer School HC20203 VRML 3 - 19 HIGHER DIPLOMA IN COMPUTING Cylinder with Dimension #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Cylinder { radius 4.0 height 1.0 }
20
© TMC Computer School HC20203 VRML 3 - 20 HIGHER DIPLOMA IN COMPUTING Cylinder with no Top and Bottom #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Cylinder { radius 4.0 height 1.0 top FALSE bottom FALSE }
21
© TMC Computer School HC20203 VRML 3 - 21 HIGHER DIPLOMA IN COMPUTING Default Sphere #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Sphere { } }
22
© TMC Computer School HC20203 VRML 3 - 22 HIGHER DIPLOMA IN COMPUTING 3D Plus Sign #VRML V2.0 utf8 Group { children [ Shape { appearance DEF White Appearance { material Material { } } geometry Box { size 25.0 2.0 2.0 } },
23
© TMC Computer School HC20203 VRML 3 - 23 HIGHER DIPLOMA IN COMPUTING 3D Plus Sign Shape { appearance USE White geometry Box { size 2.0 25.0 2.0 } }, Shape { appearance USE White geometry Box { size 2.0 2.0 25.0 } ] }
24
© TMC Computer School HC20203 VRML 3 - 24 HIGHER DIPLOMA IN COMPUTING A Space Station #VRML V2.0 utf8 Group { children [ Shape { appearance DEF White Appearance { material Material { } } geometry Box { size 10.0 10.0 10.0 } },
25
© TMC Computer School HC20203 VRML 3 - 25 HIGHER DIPLOMA IN COMPUTING A Space Station Shape { appearance USE White geometry Sphere { radius 7.0 } }, Shape { appearance USE White geometry Cylinder { radius 12.5 height 0.5 } },
26
© TMC Computer School HC20203 VRML 3 - 26 HIGHER DIPLOMA IN COMPUTING A Space Station Shape { appearance USE White geometry Cylinder { radius 4.0 height 20.0 } }, Shape { appearance USE White geometry Cylinder { radius 3.0 height 30.0 } },
27
© TMC Computer School HC20203 VRML 3 - 27 HIGHER DIPLOMA IN COMPUTING A Space Station Shape { appearance USE White geometry Cylinder { radius 1.0 height 60.0 } ] }
28
© TMC Computer School HC20203 VRML 3 - 28 HIGHER DIPLOMA IN COMPUTING Building Text Shapes In order to build text node in VRML, we need to specify the VRML Text node as the value of the Shape node’s geometry field For each of the text geometry, we can specify a list of text strings and the length of each string The FontStyle node aids us in controlling the font, style and size of the text
29
© TMC Computer School HC20203 VRML 3 - 29 HIGHER DIPLOMA IN COMPUTING Building Text Shapes Fields in the Text node enable us to control: the text string or series of characters to be built the maximum permissible extent of the lines or columns of text the exact length of each line or column of text the font or typeface to use for the text along with its style, justification, and other attributes
30
© TMC Computer School HC20203 VRML 3 - 30 HIGHER DIPLOMA IN COMPUTING Building Text Shapes The FontStyle node enables us to control: the font family defining the character shapes used for the text the font style of the text such as bold, italic or normal the font size of the text the spacing of the text lines or columns the justification of the lines or columns of text the orientation of the text: horizontal or vertical the flow direction of the text: from left to right, right to left, top to bottom or bottom to top the specific language features to use
31
© TMC Computer School HC20203 VRML 3 - 31 HIGHER DIPLOMA IN COMPUTING The Text Node The Text node is used to create text geometry and may be used as the value for the geometry field in s Shape node Text { string [ ]# exposedField MFString length [ ]# exposedFieldMFFloat maxExtent0.0# exposedFieldSFFloat fontStyleNULL# exposedFieldSFNode } The value of the string exposed field specifies one more or lines of text to build Each line or column of text is enclosed within quotation mark
32
© TMC Computer School HC20203 VRML 3 - 32 HIGHER DIPLOMA IN COMPUTING The Text Node The value of string exposed field can be changed by routing an event to the exposed field’s implied set_string eventIn The value of the length exposed field specifies the desired length, in VRML units of each line of text A length of 0.0 specifies text strings that are built at their natural length without compressing or expanding The value of the maxExtent specifies the maximum permissible length in VRML units of any line of column of text And the value of fontStyle specifies the characteristics defining the look of the text created by the Text node
33
© TMC Computer School HC20203 VRML 3 - 33 HIGHER DIPLOMA IN COMPUTING The FontStyle Node The FontStyle node is used to control the look of the text geometry created by a Text node A FontStyle node may be used as the value of the fontStyle field in a Text node FontStyle { family “SERIF”# field SFString style “PLAIN”# fieldSFString size1.0# fieldSFFloat spacing1.0# fieldSFFloat justify“BEGIN”# field SFString horizontalTRUE# fieldSFBool leftToRightTRUE# fieldSFBool topToBottomTRUE# fieldSFBool language“”# fieldSFString }
34
© TMC Computer School HC20203 VRML 3 - 34 HIGHER DIPLOMA IN COMPUTING The FontStyle Node The value of the family field specifies the standard VRML font families to use and the valid font includes: “SERIF” “SANS” “TYPEWRITER” The value of the style field specifies the text style to use and the valid style includes: “PLAIN” “BOLD” “ITALICS” “BOLDITALIC”
35
© TMC Computer School HC20203 VRML 3 - 35 HIGHER DIPLOMA IN COMPUTING The FontStyle Node The value of the size field specifies the height of the characters measured in VRML units The value of the spacing field specifies the vertical line spacing in VRML unit of horizontal text or the horizontal column spacing of the vertical text The value of the horizontal field specifies whether text strings are built horizontally or vertically The values of horizontal, leftToRight and topToBottom fields are used in combination to control horizontal or vertical text placement
36
© TMC Computer School HC20203 VRML 3 - 36 HIGHER DIPLOMA IN COMPUTING The FontStyle Node The values of justify field specifies the way in which the text shape’s block of text is positioned relative to the X and Y axes “FIRST” “BEGIN” “MIDDLE” “END” The value of the language field specifies the context of the language used in values of he Text node’s string field
37
© TMC Computer School HC20203 VRML 3 - 37 HIGHER DIPLOMA IN COMPUTING A Text Shape #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string "Qwerty" }
38
© TMC Computer School HC20203 VRML 3 - 38 HIGHER DIPLOMA IN COMPUTING A List of Text String #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string [ "Qwerty", "0123" ] }
39
© TMC Computer School HC20203 VRML 3 - 39 HIGHER DIPLOMA IN COMPUTING Small Length Field Value #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string "Qwerty" length 2.0 }
40
© TMC Computer School HC20203 VRML 3 - 40 HIGHER DIPLOMA IN COMPUTING A List of Text String #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string [ "Qwerty", “Qwerty” ] length [ 3.0, 4.0 ] }
41
© TMC Computer School HC20203 VRML 3 - 41 HIGHER DIPLOMA IN COMPUTING Text Limited by Maximum Extent #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string [ "Qwerty Uiop", "Asdf" ] maxExtent 4.0 }
42
© TMC Computer School HC20203 VRML 3 - 42 HIGHER DIPLOMA IN COMPUTING Using Plain Font #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string "Qwerty" fontStyle FontStyle { family "SERIF" style "" }
43
© TMC Computer School HC20203 VRML 3 - 43 HIGHER DIPLOMA IN COMPUTING Using Bold Font #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string "Qwerty" fontStyle FontStyle { family "SERIF" style "BOLD" }
44
© TMC Computer School HC20203 VRML 3 - 44 HIGHER DIPLOMA IN COMPUTING Using Small Font Text #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string "Qwerty" fontStyle FontStyle { size 0.5 }
45
© TMC Computer School HC20203 VRML 3 - 45 HIGHER DIPLOMA IN COMPUTING Text with more than Default Spacing #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string [ "Qwerty", "0123" ] fontStyle FontStyle { spacing 2.0 }
46
© TMC Computer School HC20203 VRML 3 - 46 HIGHER DIPLOMA IN COMPUTING Text with less than Default Spacing #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Text { string [ "Qwerty", "0123" ] fontStyle FontStyle { spacing 0.5 }
47
© TMC Computer School HC20203 VRML 3 - 47 HIGHER DIPLOMA IN COMPUTING Two Text Shape with Different Justification #VRML V2.0 utf8 Group { children [ Shape { appearance DEF White Appearance { material Material { } } geometry Text { string "First" fontStyle FontStyle { family "SERIF" style "ITALIC" justify "END" size 1.0
48
© TMC Computer School HC20203 VRML 3 - 48 HIGHER DIPLOMA IN COMPUTING Two Text Shape with Different Justification Shape { appearance USE White geometry Text { string "Second" fontStyle FontStyle { family "SANS" style "BOLD" justify "BEGIN" size 1.0 } ] }
49
© TMC Computer School HC20203 VRML 3 - 49 HIGHER DIPLOMA IN COMPUTING Two Text with a Line Between Them #VRML V2.0 utf8 Group { children [ Shape { appearance DEF White Appearance { material Material { } } geometry Text { string [ "Above", "Below" ] fontStyle FontStyle { justify "MIDDLE" } },
50
© TMC Computer School HC20203 VRML 3 - 50 HIGHER DIPLOMA IN COMPUTING Two Text with a Line Between Them Shape { appearance USE White geometry Box { size 5.0 0.01 2.0 } ] }
51
© TMC Computer School HC20203 VRML 3 - 51 HIGHER DIPLOMA IN COMPUTING Using DEF and USE to share Font Properties #VRML V2.0 utf8 Group { children [ Shape { appearance DEF White Appearance { material Material { } } geometry Text { string [ "Over", "Strike" ] fontStyle DEF myFontStyle FontStyle { size 6.0 family "TYPEWRITER" justify "MIDDLE" } },
52
© TMC Computer School HC20203 VRML 3 - 52 HIGHER DIPLOMA IN COMPUTING Using DEF and USE to share Font Properties Shape { appearance USE White geometry Text { string [ "----", "------" ] fontStyle USE myFontStyle } ] }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.