Drop shadow i_pix variant
Posted: Sun Jul 10, 2005 12:48 am
I was mucking around in "lesson.cfdg" (as you do) and decided I wanted to see if I could get drop-shadows on the text easily. "Simple" thinks I, just do this before the "real" call to TITLES:
Here's the result:
Why is this? Well, as near as I can determine, it's because the order the shapes are drawn in is only seeded by the script, due to the highly parallel nature of processing the rules: If you want to specify draw-order, it either needs to be at the primitives level, or with a sufficiently delayed start that it becomes irrelevant.
The problem with adding delay (through drawing the object shadow, drawing other stuff, then drawing the object over the shadow) is that even that will not guarantee the draw-order, plus if there is any randomness in the object, then you're not going to be able to repeat the object on top of the shadow.
This leaves us with drawing on primitives. At first I thought this would be a rather large task (having not looked into the i_pix file before)
Here are the changes you need to make to your i_pix.cfdg to get drop-shadows working:
Unfortunately, that's not quite enough, as reading further along, we see things like:
So we need to explicitly state the layout of the letters I, W and Z as well, else the drop-shadow will point in the wrong direction!
So make the following changes:
Or if you just want to use this, grab it from here
Cheers!
-Trav
PS:
Code: Select all
TITLES { x 0.05 y -0.05 b 0.7 }
TITLES { }
- [img]http://lan.net.nz/cfdg/one.png[/img]
Why is this? Well, as near as I can determine, it's because the order the shapes are drawn in is only seeded by the script, due to the highly parallel nature of processing the rules: If you want to specify draw-order, it either needs to be at the primitives level, or with a sufficiently delayed start that it becomes irrelevant.
The problem with adding delay (through drawing the object shadow, drawing other stuff, then drawing the object over the shadow) is that even that will not guarantee the draw-order, plus if there is any randomness in the object, then you're not going to be able to repeat the object on top of the shadow.
This leaves us with drawing on primitives. At first I thought this would be a rather large task (having not looked into the i_pix file before)
Here are the changes you need to make to your i_pix.cfdg to get drop-shadows working:
Code: Select all
rule block_5by5 {
SQUARE {size 0.7 x 0.2 y -0.2 b 0.7 }
SQUARE {size 0.7}
}
Code: Select all
rule W_5by5 {
M_5by5 {rotate 180}
}
So make the following changes:
Code: Select all
rule I_5by5 {
pix_5by5_00 {}
pix_5by5_10 {}
pix_5by5_20 {}
pix_5by5_30 {}
pix_5by5_40 {}
pix_5by5_21 {}
pix_5by5_22 {}
pix_5by5_23 {}
pix_5by5_04 {}
pix_5by5_14 {}
pix_5by5_24 {}
pix_5by5_34 {}
pix_5by5_44 {}
// H_5by5 {rotate 90}
}
Code: Select all
rule W_5by5 {
pix_5by5_40 {}
pix_5by5_41 {}
pix_5by5_42 {}
pix_5by5_43 {}
pix_5by5_44 {}
pix_5by5_00 {}
pix_5by5_01 {}
pix_5by5_02 {}
pix_5by5_03 {}
pix_5by5_04 {}
pix_5by5_34 {}
pix_5by5_23 {}
pix_5by5_14 {}
// M_5by5 {rotate 180}
}
Code: Select all
rule Z_5by5 {
pix_5by5_00 {}
pix_5by5_10 {}
pix_5by5_20 {}
pix_5by5_30 {}
pix_5by5_40 {}
pix_5by5_04 {}
pix_5by5_14 {}
pix_5by5_24 {}
pix_5by5_34 {}
pix_5by5_44 {}
pix_5by5_13 {}
pix_5by5_22 {}
pix_5by5_31 {}
// N_5by5 {rotate 90}
}
Cheers!
-Trav
PS:
Code: Select all
rule the5by5_testWin {
F_5by5 {x 0}
O_5by5 {x 1.2 }
R_5by5 {x 2.4}
T_5by5 {x 4.0}
H_5by5 {x 5.2}
E_5by5 {x 6.4}
W_5by5 {x 8.0}
I_5by5 {x 9.2}
N_5by5 {x 10.6}
Exclaim_5by5 {x 11.8}
Exclaim_5by5 {x 12.2}
Exclaim_5by5 {x 12.6}
}
Code: Select all
rule Exclaim_5by5 {
pix_5by5_00 {}
pix_5by5_01 {}
pix_5by5_02 {}
pix_5by5_04 {}
}