Nicholas <Yue.Nicholas@[EMAIL PROTECTED]
> wrote:
> Component wise, I will have 4 components so I can represent s,t,r
> and q for OpenGL.
I recommend using only 2 components for your TextureCoordinate class.
Then your geometry can have two (or more) members:
TextureCoordinate st; // RenderMan texture coordinates
TextureCoordinate rq; // OpenGL texture coordinates
Inside RenderDotC we find it convenient to keep coordinates over
many domains:
ugrid/vgrid go from 0 to 1 over a single Reyes grid
upatch/vpatch for individual patches within meshes
u/v are the natural parametric coordinates defined by RenderMan
s/t for user-defined texture coordinates
You may someday find that you need more than two. It will be easier
to add another TextureCoordinate than to extend the definition of it.
> can't think of operations (methods) which are unique to texture
> coordinate which are not handle by vector.
The most im****tant operation on texture coordinate is bilinear
interpolation. That's how you map coordinates from one domain
to another:
s = bilerp(u, v, s0, s1, s2, s3);
t = bilerp(u, v, t0, t1, t2, t3);
For an in-depth look at RiTextureCoordinates() see this article:
http://groups.google.com/group/comp.graphics.rendering.renderman/msg/a0408e89e030e07e
Rick LaMont
Dot C Software, Inc.
http://www.dotcsw.com/


|