Matemática e Computação
 

Mensagens
Não te abandones em lugares onde a luz da tua harmonia não esteja presente.

 


DirectionalLight - luzes direcionadas cujos raios são paralelos (como os do sol) e brilham numa direção uniforme; não têm uma posição no espaço (provêm do infinito);

DirectionalLight {
       on TRUE ( habilita ou desabilita )
       intensity 1 ( entre 0 e 1 )
       ambientIntensity 0 ( entre 0 e 1 )
       color 1 1 1 ( especifica a cor )
       direction 0 0 1 ( especifica a direção )
}

 

Exemplo 84: Iluminação DirectionalLight

Background { skyColor 0 0.2 0 }
DirectionalLight {
       direction 1 0 0
       color 1 0 0
       intensity 10
}
DirectionalLight {
       direction 0 1 0
       color 0 1 0
       intensity 10 }
DirectionalLight {
       direction 0 0 1
       color 0 0 1
       intensity 10
}
Shape {
       appearance Appearance {
              material Material {
                     diffuseColor 1.0 1.0 1.0                # r g b
              }
       }
       geometry Box { size 3 3 3 }
}                                                                            # fim do shape

Exemplo 85: Iluminação DirectionalLight

NavigationInfo {
     headlight TRUE
}
DirectionalLight {
     direction 1 0 0
     color 1 0 0
     intensity 1
}
DirectionalLight {
     direction 0 1 0
     color 0 1 0
     intensity 10
}
DirectionalLight {
     direction 0 0 1
     color 0 0 1
     intensity 10
}
DirectionalLight {
     direction 0 0 -1
     color 1 0 1
     intensity 10
}
Shape {
     appearance Appearance {
          material Material {
               diffuseColor 1.0 1.0 1.0
               transparency 0.5
          }
     }
     geometry Box { size 3 3 3 }
}
Shape {
     appearance Appearance {
          material Material {
               diffuseColor 1.0 1.0 1.0
          }
     }
     geometry Sphere {
          radius 1.5
     }
}

Exemplo 86: Iluminação DirectionalLight

NavigationInfo {
     headlight FALSE
}
.............................

Exemplo 87: Iluminação DirectionalLight

NavigationInfo {
     headlight TRUE
}
DirectionalLight {
     direction 1 0 0
     color 1 0 0
     intensity 1
}
DirectionalLight {
     direction 0 1 0
     color 0 1 0
     intensity 10
}
DirectionalLight {
     direction 0 0 1
     color 0 0 1
     intensity 10
}
DirectionalLight {
     direction 0 0 -1
     color 1 0 1
     intensity 10
}
DEF Tr Transform {
     children [
          Shape {
               appearance Appearance {
                    material Material {
                         diffuseColor 1.0 1.0 1.0
                         transparency 0.5
                    }
               }
               geometry Box { size 3 3 3 }
          }
          Shape {
               appearance Appearance {
                    material Material {
                         diffuseColor 1.0 1.0 1.0
                    }
               }
               geometry Sphere {
                    radius 1.5
               }
          }
     ]
}
DEF TI TimeSensor {
     cycleInterval 40
     loop TRUE
}
DEF OI OrientationInterpolator {
     key [ 0.00 0.07 0.14 0.21 0.28
          0.35 0.42 0.49 0.56 0.63
          0.70 0.77 0.84 0.91 0.98 ]
     keyValue [ 1 0 1 0, 1 0 1 3.14, 1 0 1 6.28, 1 0 1 3.14, 1 0 1 0,
          1 1 0 0, 1 1 0 3.14, 1 1 0 6.28, 1 1 0 3.14, 1 1 0 0,
          0 1 1 0, 0 1 1 3.14, 0 1 1 6.28, 0 1 1 3.14, 0 1 1 0 ]
}
ROUTE TI.fraction_changed TO OI.set_fraction
ROUTE OI.value_changed TO Tr.rotation

Exemplo 88: Iluminação DirectionalLight

NavigationInfo {
     headlight FALSE
}
...............................

Exemplo 89: Iluminação DirectionalLight

# The VRML 2.0 Sourcebook
# Copyright [1997] By
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
     children [
          # Vaulted ceiling and columns
          Inline {
               url "vaulted.wrl"
               bboxCenter 0.0 1.0 0.0
               bboxSize 6.0 2.0 6.0
          },
          # Floor
          Inline {
               url "mesh.wrl"
               bboxCenter 0.0 0.0 0.0
               bboxSize 15.0 0.0 15.0
          },
          # Glowing sphere
          Transform {
               translation 0.0 1.0 0.0
               children [
                    PointLight {
                         location 0.0 0.0 0.0
                         radius 10.0
                         intensity 1.0
                         ambientIntensity 0.2
                         color 0.7 0.5 0.0
                    },
                    Shape {
                         appearance Appearance {
                         # No material, use emissive texturing
                              texture ImageTexture {
                                   url "fire.jpg"
                              }
                         }
                         geometry Sphere { radius 0.2 }
                    }
               ]
          },
          # Pedestal pyramid
          Shape {
               appearance DEF White Appearance {
                    material Material { }
               }
               geometry IndexedFaceSet {
                    coord Coordinate {
                         point [
                              # Around the base
                                   -0.12 0.03 0.12, 0.12 0.03 0.12,
                                   0.12 0.03 -0.12, -0.12 0.03 -0.12,
                              # Tip
                                   0.0 0.63 0.0,
                         ]
                    }
                    coordIndex [
                         0, 1, 4, -1, 1, 2, 4, -1,
                         2, 3, 4, -1, 3, 0, 4, -1,
                    ]
                    solid TRUE
               }
          },
          # Pedestal base
          Transform {
               translation 0.0 0.015 0.0
               children Shape {
                    appearance USE White
                    geometry Box { size 0.4 0.03 0.4 }
               }
          }
     ]
}

# The VRML 2.0 Sourcebook
# Copyright [1997] By
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Transform {
     translation -8.25 0.0 -8.25
     children Shape {
          appearance Appearance {
               material Material { }
          }
          geometry ElevationGrid {
               xDimension 12
               zDimension 12
               xSpacing 1.5
               zSpacing 1.5
               solid FALSE
               height [
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
               ]
          }
     }
}

# The VRML 2.0 Sourcebook
#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright [1997] By
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
     children [
          # Center vaulted ceiling
          DEF Ceiling Transform {
               translation 0.0 2.0 0.0
               children [
                    DEF Vault Inline {
                         url "vault.wrl"
                    },
                    Transform {
                         rotation 0.0 1.0 0.0 1.57
                         children USE Vault
                    },
                    Transform {
                         rotation 0.0 1.0 0.0 3.14
                         children USE Vault
                    },
                    Transform {
                         rotation 0.0 1.0 0.0 -1.57
                         children USE Vault
                    }
               ]
          },
          # Left, right, front, and back vaulted ceilings
          Transform {
               translation -2.0 0.0 0.0
               children USE Ceiling
          },
          Transform {
               translation 2.0 0.0 0.0
               children USE Ceiling
          },
          Transform {
               translation 0.0 0.0 -2.0
               children USE Ceiling
          },
          Transform {
               translation 0.0 0.0 2.0
               children USE Ceiling
          },
          # Columns supporting the vaulted ceilings
          Transform {
               translation -3.0 1.0 -1.0
               children DEF Column Shape {
                    appearance Appearance {
                         material Material { }
                    }
                    geometry Cylinder {
                         height 2.0
                         radius 0.05
                    }
               }
          },
          Transform {
               translation -1.0 1.0 -1.0
               children USE Column
          },
          Transform {
               translation 1.0 1.0 -1.0
               children USE Column
          },
          Transform {
               translation 3.0 1.0 -1.0
               children USE Column
          },
          Transform {
               translation -3.0 1.0 1.0
               children USE Column
          },
          Transform {
               translation -1.0 1.0 1.0
               children USE Column
          },
          Transform {
               translation 1.0 1.0 1.0
               children USE Column
          },
          Transform {
               translation 3.0 1.0 1.0
               children USE Column
          },
          Transform {
               translation -1.0 1.0 -3.0
               children USE Column
          },
          Transform {
               translation -1.0 1.0 3.0
               children USE Column
          },
          Transform {
               translation 1.0 1.0 -3.0
               children USE Column
          },
          Transform {
               translation 1.0 1.0 3.0
               children USE Column
          }
     ]
}