RDHR/Grammar for Scene Description Language C

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
Back to RDHR Project.
<scene> ::= <camera> <colors> <lights> <objects>
 
<camera> ::= camera { 
               eye <three-floats>
               at <three-floats>
               up <three-floats>
               fov <float>
             }

<colors> ::= colors {
              <color-binding-list>
            }

<color-binding-list> ::= <color-name> = <rgb> <color-binding-list> |
                         __empty-string__

<color-name> ::= $<name>

<lights> ::= lights {
               <light-binding-list>
             }

<light-binding-list> ::= <light-name> = <light-specification> <light-binding-list> |
                         __empty-string__

<light-name> ::= @<name>

<light-specification> ::= <diffuse-light>

<light> ::= <light-name> | <light-specification>
            (Use @NULL to indicate no-emissoin RDF.)

<diffuse-light> ::= diffuse_light {
                      <color>
                    }

<color> ::= <color-name> | <rgb>

<rgb> ::= rgb <three-floats>

<three-floats> ::= <float> <float> <float>

<objects> ::= <object> <objects> |
              __empty-string__

<object> ::= <mesh> | <triangle> | <transform>

<mesh> ::= mesh {
             file <quoted-string>
             <color>
             <light>
           }

<triangle> ::= triangle {
                 <three-floats>
                 <three-floats>
                 <three-floats>
                 <color>
                 <light>
               }

<square> ::= square {
                <int>
                <int>
                <color>
                <light>
              }

<transform> ::= transform {
                  <transform-list>
                  <objects>
                }

<transform-list> ::= <one-transform> <transform-list> |
                     __empty-string__

<one-transform> ::= translate <three-floats> |
                    translate_x <float> |
                    translate_y <float> |
                    translate_z <float> |
                    rotate <three-floats> <float> |
                    rotate_x <float> |
                    rotate_y <float> |
                    rotate_z <float> |
                    scale <three-floats> |
                    scale_x <float> |
                    scale_y <float> |
                    scale_z <float> 
                    <matrix>

<matrix> ::= matrix {
               <sixteen-floats>
             }