POV-Ray : Newsgroups : povray.binaries.images : I've seen the light! : Re: I've seen the light! Server Time
26 Apr 2024 22:46:12 EDT (-0400)
  Re: I've seen the light!  
From: Mike Horvath
Date: 1 Dec 2016 15:24:37
Message: <58408705$1@news.povray.org>
On 12/1/2016 2:37 PM, clipka wrote:
> Am 01.12.2016 um 20:26 schrieb clipka:
>> Am 01.12.2016 um 18:16 schrieb scott:
>>>> Turns out the core module is already better than I had feared. Still, it
>>>> has highlighted various issues that still need sorting out -- mostly
>>>> expected (such as failure to set various default values upon object
>>>> construction), but a few I did not expect, like some compile-time config
>>>> settings that don't come with defaults.
>>>
>>> I guess you noticed already, but your checkered plane didn't seem to
>>> work properly either ;-)
>>
>> Bah - checkered planes are for wussies. I'm much more worried about the
>> gamma handling... ;)
>
> BTW, here's a demonstration of why I think general-purpose programming
> languages are ill-suited for scene description:
>
> 	pov::Sphere* pSphere(new pov::Sphere);
> 	pSphere->Center = pov::Vector3d(0,0,0);
> 	pSphere->Radius = 1;
> 	pSphere->Texture = new pov::TEXTURE();
> 	pSphere->Texture->Type = pov::PLAIN_PATTERN; // TODO shouldn't need this
> 	pSphere->Texture->Pigment = new pov::PIGMENT();
> 	pSphere->Texture->Pigment->Type = pov::PLAIN_PATTERN; // TODO shouldn't
> need this
> 	pSphere->Texture->Pigment->colour =
> pov_base::TransColour(pov_base::MathColour(1));
> 	pSphere->Texture->Finish = new pov::FINISH();
> 	pSphere->Texture->Finish->Ambient = pov_base::MathColour(0.05);
> 	pSphere->Texture->Finish->Diffuse = 0.1;
> 	pSphere->Texture->Finish->Brilliance = 1.0;
> 	pSphere->Texture->Finish->BrillianceAdjust = 1.0;
> 	pSphere->Texture->Finish->Specular = 2.0;
> 	pSphere->Texture->Finish->Roughness = 100;
> 	pSphere->Texture->Finish->Reflection_Min = pov::MathColour(0.0);
> 	pSphere->Texture->Finish->Reflection_Max = pov::MathColour(1.0);
> 	pSphere->Texture->Finish->Reflect_Exp = 1.0;
> 	pSphere->Texture->Finish->Reflect_Metallic = true;
> 	pSphere->Texture->Finish->Reflection_Fresnel = false;
> 	pScene->objects.push_back(pSphere);
>
> 	pov::Plane* pPlane(new pov::Plane);
> 	pPlane->Normal_Vector = pov::Vector3d(0, 1, 0).normalized();
> 	pPlane->Distance = 1;
> 	pPlane->Texture = new pov::TEXTURE();
> 	pPlane->Texture->Type = pov::PLAIN_PATTERN;
> 	pPlane->Texture->Pigment = new pov::PIGMENT();
> 	pPlane->Texture->Pigment->Type = pov::GENERIC_PATTERN;
> 	pPlane->Texture->Pigment->pattern = pov::PatternPtr(new
> pov::CheckerPattern);
> 	pov::ColourBlendMap* pCheckerMap(new pov::ColourBlendMap);
> 	pov::ColourBlendMapEntry CheckerMapEntry;
> 	CheckerMapEntry.value = 0;
> 	CheckerMapEntry.Vals = pov::ToTransColour(pov_base::RGBFTColour(0, 0,
> 0, 0, 0));
> 	pCheckerMap->Blend_Map_Entries.push_back(CheckerMapEntry);
> 	CheckerMapEntry.value = 1;
> 	CheckerMapEntry.Vals = pov::ToTransColour(pov_base::RGBFTColour(1, 1,
> 1, 0, 0));
> 	pCheckerMap->Blend_Map_Entries.push_back(CheckerMapEntry);
> 	pPlane->Texture->Pigment->Blend_Map =
> pov::GenericPigmentBlendMapPtr(pCheckerMap);
> 	pPlane->Texture->Finish = new pov::FINISH();
> 	pPlane->Texture->Finish->Ambient = pov_base::MathColour(0.1);
> 	pPlane->Texture->Finish->Diffuse = 0.7;
> 	pPlane->Texture->Finish->Brilliance = 1.0;
> 	pPlane->Texture->Finish->BrillianceAdjust = 1.0;
> 	pPlane->Texture->Finish->Specular = 0.0;
> 	pPlane->Texture->Finish->Roughness = 100;
> 	pScene->objects.push_back(pPlane);
>
> 	pov::LightSource* pLight(new pov::LightSource);
> 	pLight->Center = pov::Vector3d(-1, 1, 1).normalized() * 100;
> 	pLight->colour = pov_base::MathColour(0.7);
> 	pLight->index = 0; // TODO shouldn't need this
> 	pScene->lightSources.push_back(pLight);
>
> Yup, that's just a plain simple RSOCP scene.
>


Can't you use shorthand object notation?

pPlane =
{
	Texture =
	{
		Finish =
		{
			Ambient = pov_base::MathColour(0.1),
			Diffuse = 0.7,
			Brilliance = 1.0,
		}
	}
}

And so on...

Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.