## rota slab boundmode on macintel?

Aug 28, 2006 at 5:10pm

# rota slab boundmode on macintel?

Tangential to Pedro’s earlier post, I tried out the td.rota.jxs.help
file and the boundmode parameter doesn’t seem to do anything (open the
help file, change theta and scale, works as expected, change
boundmode, nothing seems to happen). The other parameters all appear
to work just dandy.

Are the boundmodes working differently? Am I missing something?

This is on a Macbook Pro 2ghz, osx10.4.7 max 4.6.1 jitter 1.6.1, with

Thanks!

~scott

#27356
Aug 28, 2006 at 6:39pm

Hi Scott,
Please try this version of td.rota.jxs, from before we fixed for the
AluBook.

Cheers,
Andrew B.

kaleidoscope

< ![CDATA[

//setup for 2 texture
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec2 texdim0;
uniform vec2 zoom;
uniform vec2 offset;
uniform float theta;
uniform vec2 anchor;
uniform int boundmode;
uniform sampler2DRect tex0;
uniform sampler2DRect tex1;
const float pi=3.1415926;

void main()
{
// where is the point?
vec2 sizea = texdim0;
vec2 point = texcoord0;

//transormation matrices
mat2 sca = mat2 (1./zoom.x,0.,0.,1./zoom.y);//scaling matrix (zoom)
mat2 rot = mat2
(cos(theta),sin(theta),-sin(theta),cos(theta));//rotation matrix

//perform transform
vec2 no = ((((point-anchor*sizea)*rot)*sca)+anchor*sizea)+offset;

//create boundmodes
vec2 no2 = mod(no,sizea);//wrap

vec2 no4 =
mix(mod(no,sizea),sizea-mod(no,sizea),floor(mod(no,sizea*2.)/sizea));//folded
coords

// sampler coord
vec2 tc = no*float(boundmode==0) + no*float(boundmode==1) +
no2*float(boundmode==2) + no*float(boundmode==3) + no4*float(boundmode==4);

//sample textures
vec4 smp0 = texture2DRect(tex0,tc);
vec4 smp1 = texture2DRect(tex1,sizea-texcoord0);

vec2 outbound = sign(floor(no/sizea));//check for point>size
float boundchk = float(sign(float(outbound.x!=0.)+float(outbound.y!=0.)));
float checkm0 = float(boundmode==0)*boundchk;
float checkm1 = float(boundmode==1)*float(boundchk==0.);
vec4 ifb0 = mix(smp0,smp1,checkm0);//ignore
vec4 final = ifb0*float(boundmode != 1) + ifb0*float(checkm1==1.);//clear

// output texture
gl_FragColor = final;
}
]]>

#82686
Aug 28, 2006 at 6:52pm

That seems to do the trick.

Thanks Andrew!

On 8/28/06, Andrew Benson wrote:
> Hi Scott,
> Please try this version of td.rota.jxs, from before we fixed for the
> AluBook.
>

#82687

You must be logged in to reply to this topic.