1 /* 2 Copyright (c) 2008 Seneca College 3 Licenced under the MIT License (http://www.c3dl.org/index.php/mit-license/) 4 */ 5 6 /** 7 @class 8 */ 9 c3dl.Primitive = c3dl.inherit(c3dl.Actor, function() 10 { 11 c3dl._superc(this); 12 13 // Member Variables 14 this.isPickable = true; 15 this.visible = true; 16 }); 17 18 19 // ------------------------------------------------------- 20 // Getters 21 22 /** 23 Can this object be picked when the user clicks on it? In some scripts using 24 the library, it may not make sense for wall, for example to be picked. If the 25 object cannot be picked, it will not tested against the ray which is generated 26 then the user clicks the canvas, thus increasing performance. 27 28 @returns {bool} true if the object can be picked, false otherwise. 29 */ 30 c3dl.Primitive.prototype.getPickable = function() 31 { 32 return this.isPickable; 33 } 34 35 /** 36 Will the Primitive be visible in the scene? 37 38 @returns {boolean} true if the object is rendered. 39 */ 40 c3dl.Primitive.prototype.isVisible = function() 41 { 42 return this.visible; 43 } 44 45 // ------------------------------------------------------- 46 // Setters 47 48 /** 49 Set the visibility state. 50 51 @param {boolean} show Either a true or false value which will 52 show or hide the object when rendering. 53 */ 54 c3dl.Primitive.prototype.setVisible = function(show) 55 { 56 this.visible = show; 57 } 58 59 /** 60 Set whether this object should be included in picking tests. By omitting 61 objects which should not be interacted with, it can increase performance. 62 63 @param {bool} isPickable true if the object should be included in pikcing tests, 64 false otherwise. 65 */ 66 c3dl.Primitive.prototype.setPickable = function(isPickable) 67 { 68 this.isPickable = isPickable; 69 } 70 71 /** 72 @private 73 */ 74 c3dl.Primitive.prototype.getCopy = function() 75 { 76 var primitive = new c3dl.Primitive(); 77 primitive.clone(this); 78 return primitive; 79 } 80 81 /** 82 @private 83 */ 84 c3dl.Primitive.prototype.clone = function(other) 85 { 86 c3dl._super(this, arguments, "clone"); 87 88 this.visible = other.visible; 89 this.isPickable = other.isPickable; 90 this.visible = other.visible; 91 } 92 93 /** 94 @private 95 */ 96 c3dl.Primitive.prototype.render = function(glCanvas3D, scene) 97 { 98 } 99