Recursos X3D
Documentação
- Norma em X3D® version 4 (X3D4) Architecture Specification.
- Documentação em Official x3dom Documentation.
- Tutorial em W3C: x3dom Tutorials.
- Versão estável mais recente (download).
Modelos
Os modelos abaixo funcionam assumindo que:
- Fez o download recomendado;
- O arquivo
zipfoi descompactado para a pastalib/da sua diretoria de trabalho;
Isto é, deve obter a seguinte àrvore:
(directoria de trabalho)/
lib/
x3dom/
doc/
(vários ficheiros)
(vários ficheiros)
x3dom.js
x3dom-full.js
x3dom.css
(os seus ficheiros de trabalho)
Um documento «standalone»
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="utf8">
<title>Standalone X3D</title>
<script
type='application/javascript'
src='./lib/x3dom/x3dom-full.js'>
</script>
<link
rel='stylesheet'
type='text/css'
href='./lib/x3dom/x3dom.css' />
</head>
<body>
<x3d>
<scene>
<shape>
<appearance>
<material
diffuseColor="crimson">
</material>
</appearance>
<cylinder></cylinder>
</shape>
</scene>
</x3d>
</body>
</html>
Modelo e Documento separados
Parte HTML (Documento)
Ficheiro documento.html:
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="utf8">
<title>Modelo + Documento X3D</title>
<script
type='application/javascript'
src='./lib/x3dom/x3dom-full.js'>
</script>
<link
rel='stylesheet'
type='text/css'
href='./lib/x3dom/x3dom.css' />
</head>
<body>
<div>
<x3d width="512px" height="512px">
<scene>
<inline url="modelo.x3d"></inline>
</scene>
</x3d>
</div>
</body>
</html>
Parte X3D (Modelo)
Ficheiro modelo.x3d:
<x3d>
<scene>
<shape>
<appearance>
<material diffuseColor="crimson">
</material>
</appearance>
<cylinder></cylinder>
</shape>
</scene>
</x3d>
Geometria por Faces com mapa UV
Veja como obter mapas de reflexos e de normais em NormalMap-Online.
<shape>
<appearance>
<commonsurfaceshader>
<imagetexture
containerField="diffuseTexture"
url="[mapa de DIFUSÃO]"></imagetexture>
<imagetexture
containerField="specularTexture"
url="[mapa de REFLEXOS]"></imagetexture>
<imagetexture
containerField="normalTexture"
url="[mapa de NORMAIS]"></imagetexture>
</commonsurfaceshader>
</appearance>
<indexedfaceset coordindex="
[ FACES: indices dos VÉRTICES seguido de -1 para 'terminar' cada face ]
"
texcoordindex="
[ SETORES: indices dos PONTOS seguido de -1 para 'terminar' cada setor ]
">
<coordinate point="
[ VÉRTICES: coordenadas XYZ ]
">
</coordinate>
<texturecoordinate point="
[ PONTOS: coordenadas UV ]
">
</texturecoordinate>
</indexedfaceset>
</shape>
Atalhos de teclado
| Função | Atalho |
|---|---|
| Camera mode | |
| Examine | Activate this mode by pressing the "e" key. |
| Function | Mouse Button |
| Rotate | Left / Left + Shift |
| Pan | Mid / Left + Ctrl |
| Zoom | Right / Wheel / Left + Alt |
| Set center of rotation | Double-click left |
| Camera mode | |
| Walk | Activate this mode by pressing the "w" key. |
| Function | Mouse Button |
| Move forward | Left |
| Move backward | Right |
| Camera mode | |
| Fly | Activate this mode by pressing the "f" key. |
| Function | Mouse Button |
| Move forward | Left |
| Move backward | Right |
| Camera mode | |
| Helicopter | Activate this mode by pressing the "h" key. |
| Function | Keys |
| look downwards/upwards | 8 / 9 |
| move higher/lower use the keys | 6 / 7 |
| Function | Mouse Button |
| Move forward | Left |
| Camera mode | |
| Look at | Activate this mode by pressing the "l" key. |
| Function | Mouse Button |
| Move in | Left |
| Move out | Right |
| Camera mode | |
| Game | Activate this mode by pressing the "g" key. |
| look around (rotate view) | move the mouse. |
| Function | Key |
| Move forward | Cursor up |
| Move backwards | Cursor down |
| Strafe left | Cursor left |
| Strafe right | Cursor right |
| Non-interactive camera mode | |
| Function | Key |
| Reset view | r |
| Show all | a |
| Upright | u |
| Debug | d |
| Viewpoint (debug) | v |