public void getTextureSpec(TextureSpec spec, double x, double y, double z, double xsize, double ysize, double zsize, double t, float param[]) { if (x-Math.floor(x) < width) spec.diffuse.copy(color1); else spec.diffuse.copy(color2); spec.specular.setRGB(0.0f, 0.0f, 0.0f); spec.transparent.setRGB(0.0f, 0.0f, 0.0f); spec.emissive.setRGB(0.0f, 0.0f, 0.0f); spec.bumpGrad.set(0.0, 0.0, 0.0); spec.roughness = spec.cloudiness = 0.0; }The various parameters referred to by this method are set in the constructor:
public Stripes1() { color1 = new RGBColor(1.0f, 0.0f, 0.0f); color2 = new RGBColor(1.0f, 1.0f, 1.0f); width = 0.5f; }As you can see, this is an extremely simple texture. It merely looks at the fractional part of the x component, and sets the diffuse color to one of two values accordingly.
To use this texture in Art of Illusion, select the "Textures..." command from the Scene menu. Click the "New" button. If you have added TutorialTexture.jar to your Plugins directory, you should see "Stripes 1" listed as an option for the texture type. Select it, enter a name for your texture, and click "OK". You can now assign this texture to objects, just as you would with any other texture.
Here is what the texture looks like:
Red and white stripes, exactly as promised!
Prev: Textures and TextureSpecs Next: Adding a User Interface