|
![](/i/fill.gif) |
Hello, I've written a simple file I call tiles.pov, which let's you declare a
tile and then loop it to create a roof, a chessboard, a wall or some other tiled
object. Now I need some help to turn it into a macro, something like this
#macro
Tile(ObjectToTile,OffsetX,OffsetY,OffsetZ,DistanceXtile,DistanceYtile,DistanceZtile,RotateXtile,RotateYtile,RotateZtile
)
#end
Unfortunately, I've been unable to figure out how to specify the first
parameter, ObjectToTile. I want this to be any previously declared object. Can
anyone help me solve this?
Here is the current code:
// Persistence of Vision Ray Tracer Scene Description File
// File: tiles.pov
// Vers: 3.6
// Desc: Tiles
// Date: 08/03/2010
// Auth: Haakon Meland Eriksen
// Copyright: GNU LGPLv3
#version 3.6;
#include "colors.inc"
#include "math.inc"
#include "textures.inc"
global_settings {
assumed_gamma 1.0
}
// ----------------------------------------
// perspective (default) camera
camera {
location <-3.0, 5.0, -3.0>
look_at <4.0, 1.5, 2.0>
right x*image_width/image_height
}
sky_sphere {
pigment {
gradient y
color_map {
[0.0 rgb <0.6,0.7,1.0>]
[0.7 rgb <0.0,0.1,0.8>]
}
}
}
light_source {
0*x // light's position (translated below)
color rgb 1.0 // light's color
area_light
<-8, 0, 0> <0, 0, 8> // lights spread out across this distance (x * z)
4, 4 // total number of lights in grid (4x*4z = 16 lights)
adaptive 0 // 0,1,2,3...
jitter // adds random softening of light
circular // make the shape of the light circular
orient // orient light
translate <40, 80, -40> // <x y z> position of light
}
plane {
y, 0
pigment { color rgb <0.7,0.5,0.3> }
}
// TILE0 - Flat arrow pointed - Grey
#declare Tile0 =
cone {
0.005*y, 0.145,
0*y, 0.15
// open
texture{
pigment { color Grey
}
normal {pigment_pattern{crackle
colour_map {[0, rgb 0]
[1, rgb 1]}
scale 0.0001}2}
finish {ambient 0.1 diffuse 0.9
phong 1
phong_size 250
reflection 0.15
}
}
scale x*0.3
rotate x*0 // Rotating the single tile
}
// Tile1 - Half cylinder - clay-coloured
#declare Tile1 =
difference {
cylinder {
0*x, 0.3*z, 0.10
// open
}
cylinder {
<0,0,-0.1>, 0.35*z, 0.09
// open
}
cylinder {
<0,-0.05,-0.1>, 0.35*z, 0.10
// open
}
texture {pigment {color MandarinOrange}}
rotate x*3
}
// Tile2 - Brick - clay-coloured
#declare Tile2 =
box {
<0, 0, 0> // one corner position <X1 Y1 Z1>
< 0.3, 0.1, 0.15> // other corner position <X2 Y2 Z2>
texture {pigment {color MandarinOrange} normal {bumps 14.5 scale 0.005}}
}
#declare OffsetX = 0.00;
#declare OffsetY = 0.00;
#declare OffsetZ = 0.00;
// Move tile up or down.
#declare DistanceYtile = 0.02;
// Move tile forward or backward
#declare DistanceZtile = 0.25;
// Move tile left or right
#declare DistanceXtile = 0.20;
// Rotate tile forward or backward.
#declare RotateXtile = 0.00;
// Rotate tile left or right.
#declare RotateYtile = 0.00;
// Rotate tile up or down.
#declare RotateZtile = 0.00;
#declare Tiles = union {
#declare TileX = 0;
#declare TileEndX = 90;
#while (TileX <= TileEndX) // Start making a tile in the X-direction before
continuing.
#declare TileZ = 0;
#declare TileEndZ = 9;
#while (TileZ <= TileEndZ) // Start making a rooftile in the
Z-direction before continuing.
#declare TileY = 0;
#declare TileEndY = 0;
#while (TileY <= TileEndY) // Start making a
rooftile in the Y-direction before continuing.
object {Tile1
translate <
#declare EvenZ =
even(TileZ);
#declare OffsetTileX =
TileX+OffsetX;
#if (EvenZ)
TileX*DistanceXtile
#else
OffsetTileX*DistanceXtile
#end
,
#declare OffsetTileY =
TileZ+OffsetZ;
#if (EvenZ)
OffsetTileY*DistanceYtile
#else
OffsetTileY*DistanceYtile
#end
, TileZ*DistanceZtile>
rotate x*RotateXtile
rotate y*RotateYtile
rotate z*RotateZtile
}
#declare TileY = TileY + 1;
#end
#declare TileZ = TileZ + 1;
#end
#declare TileX = TileX + 1;
#end
}
union {
object { Tiles rotate x*-25 translate x*0 translate y*0 translate z*0}
object { Tiles rotate x*-25 rotate y*180 translate x*18 translate y*0 translate
z*4.5 }
translate y*3
}
You can see the result on my homepage, http://far.no/fram/index.php?title=Tiles
If someone can help me, it would be much appreciated.
Yours sincerely,
Haakon Meland Eriksen
Post a reply to this message
|
![](/i/fill.gif) |