Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] Re: Light::setColor()?


Chronological Thread 
  • From: Abe Stephens < >
  • To:
  • Cc:
  • Subject: [Manta] Re: Light::setColor()?
  • Date: Tue, 17 Jun 2008 17:22:23 -0600
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=I9ksf1aRGBmfZiY0SdyiJ56DX+A4o5kUIxoPKV7nIHmSE82rshl/JtLk8c1AsmQTOZ siiY4EY2lMJhAxIvWvZOacNYyXF5ybYOX1UgKPSa2IcZnv4vjYiB47XCNDt8PN+0g6Kc C1EIFCqGOU852VUgWwL4j8CxwwCHhWXOLmD50=


I think because most of the Interface/ classes are supposed to be pure virtual without declaring any data members. In this case the implementations just all happen to use single Colors- a different Light implementation might use a texture instead of a single color or something.

Something similar occurs with Materials; most materials need to keep track of a light set which affects then (usually the global light set). The Material interface is pure virtual without any data members, but most of the materials inherit from LitMaterial (in Model/ Materials) which declares a data member to store the lights. I guess something like this could have been done for the lights themselves (adding a Model/Lights/ColoredLight class) but it wasn't.


Abe

On Jun 17, 2008, at 5:11 PM, Li-Ta Lo wrote:

Hi,

Why isn't there a Light::setColor() method but each subclass implements
exactly the same thing again and again?


 Lights]$ grep setColor *.h
AreaLight.h:    void setColor(Color new_c) { color = new_c; }
DirectionalLight.h:    void setColor(Color new_c) { color = new_c; }
HeadLight.h:    void setColor(const Color& new_c) { color = new_c; }
PointLight.h:    void setColor(Color new_c) { color = new_c; }

Ollie






Archive powered by MHonArc 2.6.16.

Top of page