Lines Matching full:flog
4 // http://labs.flog.nz.co/raytracer/
51 // flog/color.js
52 // flog/light.js
53 // flog/vector.js
54 // flog/ray.js
55 // flog/scene.js
56 // flog/material/basematerial.js
57 // flog/material/solid.js
58 // flog/material/chessboard.js
59 // flog/shape/baseshape.js
60 // flog/shape/sphere.js
61 // flog/shape/plane.js
62 // flog/intersectioninfo.js
63 // flog/camera.js
64 // flog/background.js
65 // flog/engine.js
68 /* Fake a Flog.* namespace */
69 if(typeof(Flog) == 'undefined') var Flog = {};
70 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
72 Flog.RayTracer.Color = Class.create();
74 Flog.RayTracer.Color.prototype = {
90 var result = new Flog.RayTracer.Color(0,0,0);
100 var result = new Flog.RayTracer.Color(0,0,0);
112 var result = new Flog.RayTracer.Color(0,0,0);
122 var result = new Flog.RayTracer.Color(0,0,0);
132 var result = new Flog.RayTracer.Color(0,0,0);
142 var result = new Flog.RayTracer.Color(0,0,0);
163 var result = new Flog.RayTracer.Color(0,0,0);
164 result = Flog.RayTracer.Color.prototype.add(
165 Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w),
166 Flog.RayTracer.Color.prototype.multiplyScalar(c2, w)
186 /* Fake a Flog.* namespace */
187 if(typeof(Flog) == 'undefined') var Flog = {};
188 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
190 Flog.RayTracer.Light = Class.create();
192 Flog.RayTracer.Light.prototype = {
213 /* Fake a Flog.* namespace */
214 if(typeof(Flog) == 'undefined') var Flog = {};
215 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
217 Flog.RayTracer.Vector = Class.create();
219 Flog.RayTracer.Vector.prototype = {
238 return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m);
246 return new Flog.RayTracer.Vector(
257 return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z);
262 return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z);
266 return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z);
270 return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w);
277 /* Fake a Flog.* namespace */
278 if(typeof(Flog) == 'undefined') var Flog = {};
279 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
281 Flog.RayTracer.Ray = Class.create();
283 Flog.RayTracer.Ray.prototype = {
295 /* Fake a Flog.* namespace */
296 if(typeof(Flog) == 'undefined') var Flog = {};
297 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
299 Flog.RayTracer.Scene = Class.create();
301 Flog.RayTracer.Scene.prototype = {
308 this.camera = new Flog.RayTracer.Camera(
309 new Flog.RayTracer.Vector(0,0,-5),
310 new Flog.RayTracer.Vector(0,0,1),
311 new Flog.RayTracer.Vector(0,1,0)
315 this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2);
318 /* Fake a Flog.* namespace */
319 if(typeof(Flog) == 'undefined') var Flog = {};
320 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
321 if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {};
323 Flog.RayTracer.Material.BaseMaterial = Class.create();
325 Flog.RayTracer.Material.BaseMaterial.prototype = {
352 /* Fake a Flog.* namespace */
353 if(typeof(Flog) == 'undefined') var Flog = {};
354 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
356 Flog.RayTracer.Material.Solid = Class.create();
358 Flog.RayTracer.Material.Solid.prototype = Object.extend(
359 new Flog.RayTracer.Material.BaseMaterial(), {
377 /* Fake a Flog.* namespace */
378 if(typeof(Flog) == 'undefined') var Flog = {};
379 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
381 Flog.RayTracer.Material.Chessboard = Class.create();
383 Flog.RayTracer.Material.Chessboard.prototype = Object.extend(
384 new Flog.RayTracer.Material.BaseMaterial(), {
413 /* Fake a Flog.* namespace */
414 if(typeof(Flog) == 'undefined') var Flog = {};
415 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
416 if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
418 Flog.RayTracer.Shape.BaseShape = Class.create();
420 Flog.RayTracer.Shape.BaseShape.prototype = {
426 this.material = new Flog.RayTracer.Material.SolidMaterial(
427 new Flog.RayTracer.Color(1,0,1),
438 /* Fake a Flog.* namespace */
439 if(typeof(Flog) == 'undefined') var Flog = {};
440 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
441 if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
443 Flog.RayTracer.Shape.Sphere = Class.create();
445 Flog.RayTracer.Shape.Sphere.prototype = {
453 var info = new Flog.RayTracer.IntersectionInfo();
456 var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position);
465 info.position = Flog.RayTracer.Vector.prototype.add(
467 Flog.RayTracer.Vector.prototype.multiplyScalar(
472 info.normal = Flog.RayTracer.Vector.prototype.subtract(
488 /* Fake a Flog.* namespace */
489 if(typeof(Flog) == 'undefined') var Flog = {};
490 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
491 if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
493 Flog.RayTracer.Shape.Plane = Class.create();
495 Flog.RayTracer.Shape.Plane.prototype = {
505 var info = new Flog.RayTracer.IntersectionInfo();
515 info.position = Flog.RayTracer.Vector.prototype.add(
517 Flog.RayTracer.Vector.prototype.multiplyScalar(
526 var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x);
542 /* Fake a Flog.* namespace */
543 if(typeof(Flog) == 'undefined') var Flog = {};
544 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
546 Flog.RayTracer.IntersectionInfo = Class.create();
548 Flog
558 this.color = new Flog.RayTracer.Color(0,0,0);
565 /* Fake a Flog.* namespace */
566 if(typeof(Flog) == 'undefined') var Flog = {};
567 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
569 Flog.RayTracer.Camera = Class.create();
571 Flog.RayTracer.Camera.prototype = {
583 this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt);
587 var pos = Flog.RayTracer.Vector.prototype.subtract(
589 Flog.RayTracer.Vector.prototype.subtract(
590 Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx),
591 Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy)
595 var dir = Flog.RayTracer.Vector.prototype.subtract(
600 var ray = new Flog.RayTracer.Ray(pos, dir.normalize());
609 /* Fake a Flog.* namespace */
610 if(typeof(Flog) == 'undefined') var Flog = {};
611 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
613 Flog.RayTracer.Background = Class.create();
615 Flog.RayTracer.Background.prototype = {
624 /* Fake a Flog.* namespace */
625 if(typeof(Flog) == 'undefined') var Flog = {};
626 if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
628 Flog.RayTracer.Engine = Class.create();
630 Flog.RayTracer.Engine.prototype = {
708 var best = new Flog.RayTracer.IntersectionInfo();
728 var R1 = Flog.RayTracer.Vector.prototype.add(
729 Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1),
732 return new Flog.RayTracer.Ray(P, R1);
737 var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience);
745 var v = Flog.RayTracer.Vector.prototype.subtract(
753 color = Flog.RayTracer.Color.prototype.add(
755 Flog.RayTracer.Color.prototype.multiply(
757 Flog.RayTracer.Color.prototype.multiplyScalar(
781 color = Flog.RayTracer.Color.prototype.blend(
794 var shadowInfo = new Flog.RayTracer.IntersectionInfo();
797 var shadowRay = new Flog.RayTracer.Ray(info.position, v);
801 var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5);
803 color = Flog.RayTracer.Color.prototype.addScalar(vA,dB);
809 var Lv = Flog.RayTracer.Vector.prototype.subtract(
814 var E = Flog.RayTracer.Vector.prototype.subtract(
819 var H = Flog.RayTracer.Vector.prototype.subtract(
825 color = Flog.RayTracer.Color.prototype.add(
826 Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight),
838 var scene = new Flog.RayTracer.Scene();
840 scene.camera = new Flog.RayTracer.Camera(
841 new Flog.RayTracer.Vector(0, 0, -15),
842 new Flog.RayTracer.Vector(-0.2, 0, 5),
843 new Flog.RayTracer.Vector(0, 1, 0)
846 scene.background = new Flog.RayTracer.Background(
847 new Flog.RayTracer.Color(0.5, 0.5, 0.5),
851 var sphere = new Flog.RayTracer.Shape.Sphere(
852 new Flog.RayTracer.Vector(-1.5, 1.5, 2),
854 new Flog.RayTracer.Material.Solid(
855 new Flog.RayTracer.Color(0,0.5,0.5),
863 var sphere1 = new Flog.RayTracer.Shape.Sphere(
864 new Flog.RayTracer.Vector(1, 0.25, 1),
866 new Flog.RayTracer.Material.Solid(
867 new Flog.RayTracer.Color(0.9,0.9,0.9),
875 var plane = new Flog.RayTracer.Shape.Plane(
876 new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(),
878 new Flog.RayTracer.Material.Chessboard(
879 new Flog.RayTracer.Color(1,1,1),
880 new Flog.RayTracer.Color(0,0,0),
892 var light = new Flog.RayTracer.Light(
893 new Flog.RayTracer.Vector(5, 10, -1),
894 new Flog.RayTracer.Color(0.8, 0.8, 0.8)
897 var light1 = new Flog.RayTracer.Light(
898 new Flog.RayTracer.Vector(-3, 5, -15),
899 new Flog.RayTracer.Color(0.8, 0.8, 0.8),
915 var raytracer = new Flog.RayTracer.Engine(