|
CubeTwister 2.0alpha141 2011-10-13 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectidx3d.idx3d_Rasterizer
idx3d.idx3d_PerspectiveRasterizer
public final class idx3d_PerspectiveRasterizer
Perspective-correct rasterizer stage of the render pipeline.
This rasterizer performs non-linear perspective-correct interpolation of
textures. The algorithm is slower than idx3d_PerspectiveRasterizer
but produces less distortions.
Perspective-correct texturing:
Screen
---+------------------→ z-Axis
|
|
| z1.Textured Surface
| . '/
| . ' /
| . ' / xf := 0;
x1. ' / dxf := 1.0/(x2 - x1);
Eye . ' | / for x := x1 to x2
*------x+--------→+tr xf := xf + dxf;
' . | /
x2' . /
| ' ./
| z2 '
↓
X-Axis
Non-optimized pseudo code which calculates for each screen pixel x between
x1 and x2 the relative texture coordinate tr.
int x1, x2, z1, z2; real xr, tr; for x := x1 to x2 do xr := (x - x1) / (x1 - x2); tr := xr * z1 / (xr * z1 + (1 - xr) * z2); ...use tr... endOptimized pseudo code which calculates for each screen pixel x between x1 and x2 the relative texture coordinate tr.
int x1, x2, z1, z2; real tr, tn, td, dtn, dtd; int dx; dtd := z1 / (x2 - x1) - (z2 / (x2 - x1); dtn := z1 / x2 - x1; td := z2; tn := 0; for x := x1 to x2 do tr := tn / td; ...use tr... td := td + dtd; tn := tn + dtn; end
| Field Summary | |
|---|---|
boolean |
ready
|
| Constructor Summary | |
|---|---|
idx3d_PerspectiveRasterizer(idx3d_RenderPipeline pipeline)
|
|
| Method Summary | |
|---|---|
boolean |
isAntialiased()
|
void |
loadLightmap(idx3d_Lightmap lm)
Lightmap loader. |
void |
loadMaterial(idx3d_InternalMaterial material)
Material loader. |
static void |
main(java.lang.String[] args)
|
void |
render(idx3d_Triangle tri)
Renderer. |
void |
setPipeline(idx3d_RenderPipeline pipeline)
Render pipeline. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public boolean ready
| Constructor Detail |
|---|
public idx3d_PerspectiveRasterizer(idx3d_RenderPipeline pipeline)
| Method Detail |
|---|
public void setPipeline(idx3d_RenderPipeline pipeline)
idx3d_Rasterizer
setPipeline in class idx3d_Rasterizerpublic boolean isAntialiased()
public void loadLightmap(idx3d_Lightmap lm)
idx3d_Rasterizer
loadLightmap in class idx3d_Rasterizerpublic void loadMaterial(idx3d_InternalMaterial material)
idx3d_Rasterizer
loadMaterial in class idx3d_Rasterizerpublic void render(idx3d_Triangle tri)
idx3d_Rasterizer
render in class idx3d_Rasterizerpublic static void main(java.lang.String[] args)
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||