home games dev
Lewpen.com»Research & Development»3D Graphics»Java 3D Engine»3D Pillars»White Outline (Cartoon Shading)

White Outline (Cartoon Shading)

Using a postprocessing effect which finds outlines using discontinuities in the Z-buffer

/ Source / Transform.java

/*

Transform

*/

//---- Transform -------------------------------------------------------------//

public class Transform
{
  //---- Data
  
  private Matrix m;

  //---- Transform() - Creates new transformation

  public Transform()
  {
    m = Matrix.transformation();
  }

  //---- Transform(Transform t) - Creates new transformation

  public Transform(Transform t)
  {
    m = new Matrix(t.m);
  }

  //---- identity() - Resets the transformation
  
  public void identity()
  {
    m = null;
    m = Matrix.transformation();
  }

  //---- scale(sx, sy, sz) - Scales the current transformation
  
  public void scale(double sx, double sy, double sz)
  {
    m = Matrix.scaling(sx, sy, sz).multiply(m);
  }

  //---- translate(x, y, z) - Translates the current transformation
  
  public void translate(double x, double y, double z)
  {
    m = Matrix.translate(x, y, z).multiply(m);
  }

  //---- rotateX
  
  public void rotateX(double r)
  {
    m = Matrix.rotateX(r).multiply(m);
  }

  //---- rotateY
  
  public void rotateY(double r)
  {
    m = Matrix.rotateY(r).multiply(m);
  }

  //---- rotateZ
  
  public void rotateZ(double r)
  {
    m = Matrix.rotateZ(r).multiply(m);
  }

  //---- multiply - multiplies a vector by the transformation

  public double[] multiply(double[] v)
  {
    return m.multiply(v);
  }

  public void multiply(double src[], double dest[])
  {
    m.multiply(src, dest);
  }

  //---- transform
  
  public void transform(Transform t)
  {
    m = m.multiply(t.m);
  }

}

Comments

Related Articles

Demonstration scene with reflection

Sponsored Links

Toys & Games:

Doggie Doo
Nerf Vortex
Monster High
Lagoona Hydration Station
Milky Bunny
Moshling Tree House
Lego Ninja Go Fire Temple
Fireman Sam Pontypandy Rescue
Rock Elmo
Star Wars Ultimate Force Lightsaber

Games

The Dodge Game
Flatspace

2-Player Games:

Quake 2D
Meteora

Puzzle Games:

Mini Tetris
Sudoku Solver

Development

3D Graphics:

3D Graphics Articles
WebGL Examples
Flash 3D Engine
Java 3D Engine

Development:

Programming Articles
Animation Demos
Game Development Examples

Links

iBuddy Social Network
Local Legends Football
PHP Charts & Graphs
CubeLogix Studios