X3D
X3D , , XML (eXtensible Markup Language, ) .
X3D Web3D ISO. 3.0 2003 . ( 2012) 3.3.
X3D VRML (Virtual Reality Modelling Language, ), 1990- .
HTML5
HTML5 ( 2012 ) HTML (HyperText Markup Language, ), -.
, , W3C (World Wide Web Consortium, ) HTML 4.01, ISO 2000 .
, - 2D- 3D-. ( API Javascript), ( HTML- DOM (Document Object Model, )).
<canvas> ( 4.8.11 ), <svg>, XML SVG (Scalable Vector Graphics, ) ( 4.8.16 ).
2012 , . , WebGL (Web-based Graphics Library, ), Khronos Group, Mozilla, Google, Apple, Opera, AMD Nvidia. WebGL <canvas>, Javascript GPU , . WebGL 2006 , 2011 .
3D- Fraunhofer X3DOM. 2009 .
X3DOM
X3DOM , WebGL - , X3D, .
X3DOM
<X3D> , X3DOM.
|
|
. | |||
showLog | true, false | false | / |
showStat | true, false | false | / |
showProgress | true, false, bar | true | / . . bar . |
width | 300px | . | |
height | 150px |
X3DOM , <X3D> . , , :
<X3D style="left:0px; top:0px; width:100%; height:100%; border:none;">
X3DOM :
(Examine)
"e".
/ + Shift | |
/ + Ctrl | |
/ / + Alt | |
. . |
(Walk)
"w".
(Fly)
"f".
(Helicopter)
"h".
/: 8/9
/: 6/7.
(Look at)
"l".
(Game)
"g".
.
Cursor right |
:
r | |
a | |
u |
X3DOM HTML- <X3D>, XML-, .
, , , , .. , . . (DEF/USE), , bounding box, backface culling, convex- . , real-time. .
, , , , . .
|
|
X3D X3D, http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/Architecture.html
:
- ,
- , :
- (SFFloat, MFInt32)
- ([], [in], [out], [in,out]). . [] [in,out]
X3D, XML, XML ( ), ( ='' ).
,
<Viewpoint orientation='0 -1 0 0.05' position='0.13 2.51 11.24'> </Viewpoint>
, . .
.
X3D
SFBool | true | |
MFBool | true false false true | |
SFColor | RGB | 0 0.5 1.0 |
MFColor | RGB | 1 0 0, 0 1 0, 0 0 1 |
SFColorRGBA | RGB alpha- () | 0 0.5 1.0 0.75 |
MFColorRGBA | RGB alpha- () | 1 0 0 0.25, 0 1 0 0.5, 0 0 1 0.75 |
SFInt32 | 32- | |
MFInt32 | 32- | 1 2 3 4 5 |
SFFloat | 1.0 | |
MFFloat | -1 2.0 3.14159 | |
SFDouble | 2.7128 | |
MFDouble | -1 2.0 3.14159 | |
SFImage | 2 2 3 0xFF0000 0x00FF00 0x0000FF 0xFF0000 | |
MFImage | 2 2 3 0xFF0000 0x00FF00 0x0000FF 0xFF0000, 2 2 3 0x00FF00 0x0000FF 0xFF0000 0xFF0000 | |
SFNode | <Shape /> | |
MFNode | <Shape /> <Transform /> | |
SFRotation | (3 , ) | 0 1 0 1.57 |
MFRotation | 0 1 0 0, 0 1 0 1.57, 0 1 0 3.14 | |
SFString | Hello world | |
MFString | Hello world | |
SFTime | ||
MFTime | −1 0 1 567890 | |
SFVec2F/SFVec2D | 2 / | 0 1.5 |
MFVec2F/MFVec2D | 2 / | 1 0, 2 2, 3 4, 5 5 |
SFVec3F/SFVec3D | 3 / | 0 1.5 2 |
MFVec3F/MFVec3D | 3 / | 10 20 30, 4.4 −5.5 6.6 |
Shape: X3DShapeNode { SFNode [in,out] appearance NULL [X3DAppearanceNode] SFNode [in,out] geometry NULL [X3DGeometryNode] SFNode [in,out] metadata NULL [X3DMetadataObject] SFVec3f [] bboxCenter 0 0 0 (-∞,∞) SFVec3f [] bboxSize -1 -1 -1 [0,∞) or −1 −1 −1}
|
|
Shape .
Shape . , Appearance, , Material, / , . , Shape .
, , . . ( ) WebGL.
: solid.
, ( , ) 2 . (backface culling), . backface culling , , . , solid=false, backface culling.
, X3D, .
(0,0,0).
metadata () .
Box
Box: X3DGeometryNode {
SFNode [in,out] metadata NULL [X3DMetadataObject]
SFVec3f [] size 2 2 2 (0,∞)
SFBool [] solid TRUE
}
[] [in,out]. [in] [out] design-time .
:
size .
1x2x3 .
<!DOCTYPE html><html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title> 1</title> <link rel="stylesheet" type="text/css" href="x3dom.css" /> <script type="text/javascript" src="x3dom.js"></script> </head> <body> <h1> 1</h1> <X3D> <Scene> <Shape> <Appearance> <Material></Material> </Appearance> <Box size=1 2 3></Box> </Shape> </Scene> </X3D> </body></html> html- . <Scene>, , , X3D-, .
Cylinder
Cylinder: X3DGeometryNode { SFNode [in,out] metadata NULL [X3DMetadataObject] SFBool [] bottom TRUE SFFloat [] height 2 (0,∞) SFFloat [] radius 1 (0,∞) SFBool [] side TRUE SFBool [] solid TRUE SFBool [] top TRUE}
radius height . 3 : side, top, bottom, true false ( true), , , (, , bottom=false).
|
|
Cone
.
Cone: X3DGeometryNode {
SFNode [in,out] metadata NULL [X3DMetadataObject]
SFBool [] bottom TRUE
SFFloat [] bottomRadius 1 (0,∞)
SFFloat [] height 2 (0,∞)
SFBool [] side TRUE
SFBool [] solid TRUE
}
:
bottomRadius
height
1 Y, 1 . Y.
Sphere
.
Sphere: X3DGeometryNode { SFNode [in,out] metadata NULL [X3DMetadataObject] SFFloat [] radius 1 (0,∞) SFBool [] solid TRUE}
:
radius
Text
Text 2D-.
Text: X3DGeometryNode { SFNode [in,out] fontStyle NULL [X3FontStyleNode] MFFloat [in,out] length [] [0,∞) SFFloat [in,out] maxExtent 0.0 [0,∞) SFNode [in,out] metadata NULL [X3DMetadataObject] MFString [in,out] string [] MFVec2f [out] lineBounds SFVec3f [out] origin SFVec2f [out] textBounds SFBool [] solid FALSE}
FontStyle: X3DFontStyleNode { SFNode [in,out] metadata NULL [X3DMetadataObject] MFString [] family "SERIF" SFBool [] horizontal TRUE MFString [] justify "BEGIN" ["BEGIN","END","FIRST","MIDDLE",""] SFString [] language "" SFBool [] leftToRight TRUE SFFloat [] size 1.0 (0,∞) SFFloat [] spacing 1.0 [0,∞) SFString [] style "PLAIN" ["PLAIN"|"BOLD"|"ITALIC"|"BOLDITALIC"|""] SFBool [] topToBottom TRUE}
Text:
string .
fontStyle FontStyle, .
maxExtent - .
length - .
FontStyle:
size - ( ).
family , ["Lucida Sans Typewriter", "Lucida Sans", "Helvetica", "SANS"]. , SERIF ( ), SANS ( ) TYPEWRITER ()style - PLAIN, BOLD, ITALIC BOLDITALIC.
horizontal - TRUE, FALSE.
leftToRight - TRUE( ) FALSE().
topToBottom - TRUE( ) FALSE().
language - (2 ).
justify - BEGIN, MIDDLE END.
spacing - (1-normal, 2-double spacing, ..).
Torus
.
, X3DOM X3D.
:
innerRadius
outerRadius
, Transform.
Transform ()
:
Transform: X3DGroupingNode { MFNode [in] addChildren [X3DChildNode] MFNode [in] removeChildren [X3DChildNode] SFVec3f [in,out] center 0 0 0 (-∞,∞) MFNode [in,out] children [] [X3DChildNode] SFNode [in,out] metadata NULL [X3DMetadataObject] SFRotation [in,out] rotation 0 0 1 0 [-1,1] or (-∞,∞) SFVec3f [in,out] scale 1 1 1 (-∞, ∞) SFRotation [in,out] scaleOrientation 0 0 1 0 [-1,1] or (-∞,∞) SFVec3f [in,out] translation 0 0 0 (-∞,∞) SFVec3f [] bboxCenter 0 0 0 (-∞,∞) SFVec3f [] bboxSize -1 -1 -1 [0,∞) or −1 −1 −1}
:
center (0,0,0), .
children (, ), .
rotation , (3 X Y Z), .
|
|
scale / X Y Z ( ).
scaleOrientation .
translation X Y Z.
bboxCenter | -
bboxSize | (Bounding Box), children
addChildren | - ,
removeChildren | children.
children, .
Bounding Box , . .
( ) :
1) (, )
2)
3)
Appearance
.
:
Appearance: X3DAppearanceNode { SFNode [in,out] fillProperties NULL [FillProperties] SFNode [in,out] lineProperties NULL [LineProperties] SFNode [in,out] material NULL [X3DMaterialNode] SFNode [in,out] metadata NULL [X3DMetadataObject] MFNode [in,out] shaders [] [X3DShaderNode] SFNode [in,out] texture NULL [X3DTextureNode] SFNode [in,out] textureTransform NULL [X3DTextureTransformNode]}
Material
.
:
Material: X3DMaterialNode { SFFloat [in,out] ambientIntensity 0.2 [0,1] SFColor [in,out] diffuseColor 0.8 0.8 0.8 [0,1] SFColor [in,out] emissiveColor 0 0 0 [0,1] SFNode [in,out] metadata NULL [X3DMetadataObject] SFFloat [in,out] shininess 0.2 [0,1] SFColor [in,out] specularColor 0 0 0 [0,1] SFFloat [in,out] transparency 0 [0,1]}
:
diffuseColor (R G B, R,G B 0 1; , 0.5 0.5 0.5).
specularColor (R G B).
emissiveColor ( ) (R G B).
ambientIntensity ( 0 1). , .
shininess ( 0 1). , , , . , .
transparency ( 0 1)
TwoSidedMaterial
.
:
TwoSidedMaterial: X3DMaterialNode { SFFloat [in,out] ambientIntensity 0.2 [0,1] SFFloat [in,out] backAmbientIntensity 0.2 [0,1] SFColor [in,out] backDiffuseColor 0.8 0.8 0.8 [0,1] SFColor [in,out] backEmissiveColor 0 0 0 [0,1] SFFloat [in,out] backShininess 0.2 [0,1] SFColor [in,out] backSpecularColor 0 0 0 [0,1] SFFloat [in,out] backTransparency 0 [0,1] SFColor [in,out] diffuseColor 0.8 0.8 0.8 [0,1] SFColor [in,out] emissiveColor 0 0 0 [0,1] SFNode [in,out] metadata NULL [X3DMetadataObject] SFFloat [in,out] shininess 0.2 [0,1] SFBool [in,out] separateBackColor FALSE SFColor [in,out] specularColor 0 0 0 [0,1] SFFloat [in,out] transparency 0 [0,1]}
ImageTexture
.
:
ImageTexture: X3DTexture2DNode, X3DUrlObject { SFNode [in,out] metadata NULL [X3DMetadataObject] MFString [in,out] url [] [URI] SFBool [] repeatS TRUE SFBool [] repeatT TRUE SFNode [] textureProperties NULL [TextureProperties]}
X3D , , . , , Shape (Appearance), . , /// Color Normal.
() .
Coordinate
.
:
point
<Coordinate point='0 0 0, 1 1 1'></Coordinate>
Color ColorRGBA
Color RGB.
Color RGBA. (-).
:
color
<Color color='0 0 0, 1 1 1, 1 0 0, 0 1 0, 0 0 1'></Color>
<ColorRGBA color='0 0 0 0.5, 1 1 1 0.5, 1 0 0 0.5, 0 1 0 0.5, 0 0 1 0.5'></ColorRGBA>
Normal
.
:
vector
:
<normal vector=1 0 1, -1 0.5 -1, -2 0 -3> </normal>3 .
, .