POV-Ray : Newsgroups : povray.programming : Proposal for 4.0 core control : Re: Proposal for 4.0 core control Server Time
28 Jul 2024 12:24:49 EDT (-0400)
  Re: Proposal for 4.0 core control  
From: Christopher James Huff
Date: 17 Oct 2002 10:56:39
Message: <chrishuff-693207.10514517102002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 Philippe Lhoste <Phi### [at] GMXnet> wrote:

> It seems that modern compilers replaced these symbols by keywords...
> See a page of codes to solve a "real" problem at 
> <http://www.chilton.com/~jimw/ballclk.html> for example.

Gah! And this language *wasn't* designed to be obfuscated?


> What is exactly a shader language. I see this a lot with Renderman and 
> compatibles, but I am not sure of what it is and how it is used... 
> Something like procedural textures?

It means a language that you write shaders in. ;-)
A shader is just a piece of code that computes the color of an object. 
They are usually used for procedural textures.
POV-Ray functions could be considered a very primitive shader language, 
the texture language is nearly as flexible as a more "traditional" 
language, though it is harder to accomplish some of the same things and 
some things aren't possible.

G will have a fairly C-like syntax:
scalar myScalar = 3.14159;
vector y = < 0, 1, 0>;

function scalar VNormalize(vector vec);

function scalar VNormalize(vector vec) {
    return sqrt(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z);
};

The loops and conditionals will have the same syntax they do in 
Sapphire, it will be very C-like.
That's pretty much it...scalars, vectors, and functions. Maybe arrays 
will be added. While Sapphire is extremely dynamic and flexible, this 
will be as simple and static as possible.
I'll probably make an attempt to add it to POV, the syntax will be 
something like:
g {
    //G declarations and statements
    function vector Foo(vector pt) {...};
}

G functions will be called through POV functions:
#declare Foo = function (n) {g {return Foo(n);}}
Or maybe something like this:
#declare Foo = g_function Foo(n);

You would also be able to use Foo in a pigment:
pigment {g_function Foo}

I haven't decided how to pass POV variables through to G functions yet. 
Maybe by calling a G function to set a G variable, maybe by adding some 
"import" directive to grab a variable from the POV namespace.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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