Dumb question: diffuseColor 
Author Message
 Dumb question: diffuseColor

Hi all, I'm new to VRML, just wondering if I want to reuse a colour how do I
define it as an entity so I can just use it later on? For instance, in the
shape statements I might use diffuseColor .8 .75 .7 but if I want to use it
somewhere else again (for a group of similar shapes/walls) is there a way to
def it earlier and then just recall it? I tried DEF GREY Color {color [.8
.75 .7]} and then diffuseColor USE GREY but that didn't work... I'm a bit
confused with this def and use thing please enlighten me...

Thanks, Jules



Fri, 18 Nov 2005 11:16:39 GMT  
 Dumb question: diffuseColor

Quote:
> def it earlier and then just recall it? I tried DEF GREY Color {color [.8
> .75 .7]} and then

Hi Jules,

Color is not a node but Material is. You can only DEF nodes.
DEF MYMAT Material{diffuseColor .1 .1 .9}

reuse it:

Shape{appearance Appearance{material USE MYMAT} geometry ...}

Regards, Roland



Fri, 18 Nov 2005 16:28:36 GMT  
 Dumb question: diffuseColor

Quote:
> DEF MYMAT Material{diffuseColor .1 .1 .9}
> Shape{appearance Appearance{material USE MYMAT} geometry ...}

This is invalid VRML97 ! (Despite some tools would accept it)

Material is not a root node.

http://www.web3d.org/technicalinfo/specifications/vrml97/part1/concep...
http://www.web3d.org/technicalinfo/specifications/vrml97/part1/concep...

Some tools export such prior "defines" in a switch node with switch is off,
like this:

#VRML V2.0 utf8

Switch
  {
  choice
    [
    Shape
      {
      appearance       Appearance
        {
        DEF MYMAT material        Material
          {
          diffuseColor .1 .1 .9
          }
        }
      }
    ]
  }

Shape{appearance Appearance{material USE MYMAT} geometry ...}



Fri, 18 Nov 2005 19:46:10 GMT  
 Dumb question: diffuseColor

Quote:
> This is invalid VRML97 ! (Despite some tools would accept it)

Hm ? It only says Material is no children node.
I couldn't find a word about not being allowed to be a root node ?!

Quote:

> Material is not a root node.

I'm sure you mean "no children node" ?!
Or do you mean, it's allowed to use it as a root node ?
But that's exactly the way I've used it.

Roland

Quote:

> http://www.web3d.org/technicalinfo/specifications/vrml97/part1/concep...
> http://www.web3d.org/technicalinfo/specifications/vrml97/part1/concep...

> Some tools export such prior "defines" in a switch node with switch is off,
> like this:

> #VRML V2.0 utf8

> Switch
>   {
>   choice
>     [
>     Shape
>       {
>       appearance       Appearance
>         {
>         DEF MYMAT material        Material
>           {
>           diffuseColor .1 .1 .9
>           }
>         }
>       }
>     ]
>   }

> Shape{appearance Appearance{material USE MYMAT} geometry ...}



Fri, 18 Nov 2005 21:31:07 GMT  
 Dumb question: diffuseColor

Quote:
>> This is invalid VRML97 ! (Despite some tools would accept it)
> Hm ? It only says Material is no children node.
> I couldn't find a word about not being allowed to be a root node ?!
>> Material is not a root node.
> I'm sure you mean "no children node" ?!

http://www.web3d.org/technicalinfo/specifications/vrml97/part1/concep...

| Root nodes shall be children nodes (see
| 4.6.5, Grouping and children nodes).

So if it is not valid as children node, it can not be a root node.

so long
MUFTI
--
Die 47800 ueblich-Beschluss-Fotos wollen pixelate leichter
als die 5400 Hallo-Beschluss-Fotos.
           (aus einem Softwarehandbuch, Stichworte: common/high resolution)



Fri, 18 Nov 2005 23:55:37 GMT  
 Dumb question: diffuseColor

Quote:
>>DEF MYMAT Material{diffuseColor .1 .1 .9}

>>Shape{appearance Appearance{material USE MYMAT} geometry ...}

 >
 > This is invalid VRML97 ! (Despite some tools would accept it)
 >
 > Material is not a root node.
 >

Some time i had the idea of using a Proto for this:

PROTO NodeHolder
[
     field MFNode nodes []
]
{
     WorldInfo {}

Quote:
}

NodeHolder
{
     nodes
     [
         DEF MYMAT Material{diffuseColor .1 .1 .9}

         DEF MyHat Shape {
             ...
         }
     ]

Quote:
}

It assignes the nodes to a field that has no IS connection inside the
Proto.

Quote:

> Some tools export such prior "defines" in a switch node with switch is off,
> like this:

> #VRML V2.0 utf8

> Switch
>   {
>   choice
>     [
>     Shape
>       {
>       appearance       Appearance
>         {
>         DEF MYMAT material        Material
>           {
>           diffuseColor .1 .1 .9
>           }
>         }
>       }
>     ]
>   }

> Shape{appearance Appearance{material USE MYMAT} geometry ...}

--
Herbert Stocker (aka hersto)
   http://www.hersto.de/VRML
   http://www.bitmanagement.de


Sat, 19 Nov 2005 01:32:47 GMT  
 Dumb question: diffuseColor

Quote:
>>>DEF MYMAT Material{diffuseColor .1 .1 .9}
>>>Shape{appearance Appearance{material USE MYMAT} geometry ...}
> > This is invalid VRML97 ! (Despite some tools would accept it)
> Some time i had the idea of using a Proto for this:
> PROTO NodeHolder
> [
>     field MFNode nodes []
> ]
> {
>     WorldInfo {}
> }
> NodeHolder
> {
>     nodes
>     [
>         DEF MYMAT Material{diffuseColor .1 .1 .9}
>         DEF MyHat Shape {
>             ...
>         }
>     ]
> }
> It assignes the nodes to a field that has no IS connection inside the
> Proto.

A interesting question, if a very intelligent browser may optimize
it away....

so long
MUFTI
--
Pers?nlicher Benutzer - fr den einzelnen Benutzer hing der
Wunsch des kompakten, hohen Klarheit Kopfes SVGA-Bildschirmanzeigen
                               (aus einer Webseite fuer einen 3D Datenhelm)



Sat, 19 Nov 2005 22:00:02 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Dumb newbie asks dumber question

2. GPF goes away when use debugger...or Dumb and Dumber

3. problems with diffuseColor

4. ambientColor and diffuseColor

5. problem setting diffuseColor in javascript

6. Dumb question re date/time picker

7. Automation - dumb question

8. Dumb beginner question...

9. Real Dumb Question on APL Domino

10. Dumb question about binary representaions in J

11. more dumb newbie questions

12. Benchmark Workshop tool - dumb (?) question

 

 
Powered by phpBB® Forum Software