Re: SPEC - isA

Chris Marrin ([email protected])
Thu, 18 May 1995 10:03:39 -0700


> To be easy to parse, we'd probably then want to say that isA needed to
come
> before any other fields. A parser would have trouble with:
>
> ExtendedMaterial { fields [ MFString isA ]
> diffuseColor .8 .54 .1
> isA "Material"
> }
>

I still think it is tricky to parse. This is especially true if you give
more than one string to isA. How do I choose? The first one I
understand? The best match with the given fields? The easiest way to
handle isA is to read in the node as unknown, then go back and see if
there's an isA field. If so, match up the field and types and pick an
existing node based on that. This would require a fully specified fields
field.

I agree with Gavin that this will not be a big bandwidth drain. Gzip can
compress repeating field names really well. And you needn't specify an
existing node fully. This will work:

Refraction {
fields [ MFColor diffuseColor, MFFloat refractionIndex ]
diffuseColor 1 1 0
refractionIndex 0.5
isA "Material"
}

This should create a material node, set the diffuseColor field to the
given value and leave the others at their default.

-- 
chris marrin      Silicon      http://www.sgi.com/Products/WebFORCE/WebSpace
(415) 390-5367    Graphics  ," http://reality.sgi.com/employees/cmarrin/
[email protected]   Inc.    b`    ,                             ,,.
                        mP     b"                            , 1$'
        ,.`           ,b`    ,`                              :$$' 
     ,|`             mP    ,`                                             ,mm
   ,b"              b"   ,`                ,mm      m$$    ,m          ,,`P$$
  m$`             ,b`  .` ,mm          ,.`'|$P   ,|"1$`  ,b$P       ,,`   :$1
 b$`             ,$: :,`` |$$       ,:`    $$` ,|` ,$$,,`"$$      .`      :$|
b$|            _m$`,:`    :$1    ,:`      ,$Pm|`    `    :$$,..;"'        |$:
P$b,      _;b$$b$1"       |$$ ,,``       ,$$"             ``'             $$
 ```"```'"    `"`         `""`           ""`                             ,P`
"As a general rule, don't solve puzzles that open portals to Hell."-...-'
		   - excerpt from "A Horror Movie Character's Survival Guide"