Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader OslCamera(
- matrix objectTransform = matrix(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),
- float objectSize = 3.6,
- output point pos = P,
- output vector dir = I,
- output float tMax = 1.0/0.0)
- {
- point cubePos = 0;
- // left
- if( u <= 0.5 && v <= 0.5)
- {
- cubePos = point(-0.5, -0.5 + 2 * v, -0.5 + 2 * u);
- }
- // right
- else if(u >= 0.5 && v < 0.5)
- {
- cubePos = point(-0.5 + (u-0.5)*2, -0.5 + 2 * v, 0.5);
- }
- // top
- else if (u > 0.5 && v >= 0.5)
- {
- cubePos = point(-0.5 + (u-0.5)*2, 0.5, 0.5 - (v-0.5)*2);
- }
- else
- {
- tMax = 0;
- }
- matrix objScale = matrix(objectSize);
- matrix finalTrans = objectTransform * objScale;
- point worldPos = transform(finalTrans, cubePos);
- dir = worldPos - P;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement