1 /**
  2  * @class material
  3  * @description
  4  * Defines how a mesh should be visualized.
  5  *
  6  * Materials are the main way to have advanced graphics control
  7  * with customized behavior. With custom or built-in {@link shader} objects,
  8  * materials provide the data inputs to these programs allowing for dynamic 
  9  * visuals.
 10  *
 11  * 
 12  */ 
 13 function material() {
 14 
 15     /**
 16      * Adds a texture to be drawn.
 17      *
 18      * How textures interact with the mesh is dependent on the material attached with 
 19      * {@link renderMesh.material}. If the material is using a {@link sandboxe.material.coreProgram}, {@link sandboxe.material.textureSlot.color} 
 20      * will be used as an RGBA texture, {@link sandboxe.material.textureSlot.normal} will be used as a lighting normal map,
 21      * and {@link sandboxe.material.textureSlot.shiny} will be used as a light reflectivity map. For user-made programs using
 22      * Shader, the first argument refers to what texture slot you can access the texture from in 
 23      * the shader programming language. Refer to {@link shader} for more info. Note that using textureSlot.color,
 24      * .normal, and .shiny are equivalent to calling addTexture() with 0, 1, and 2 respectively as 
 25      * the texture slot argument.
 26      * @param {Number} slot The texture slot. See {@link sandboxe.material.textureSlot}
 27      * @param {asset} image The image to use a texture. Multiple frames are supported and can be iterated through dynamically.
 28      */
 29     this.addTexture = function(){};
 30 
 31     /**
 32      * Sets the given camera as the source framebuffer.
 33      *
 34      * The source framebuffer is an optional input you can specify 
 35      * to utilize the last known visual of a camera as a texture 
 36      * source. This can be used in a few different ways. Once its set, 
 37      * sandboxe.material.corePrograms will map it as another texture binding.
 38      * To disable this, simply call setFramebufferSource again with a 
 39      * default entity. If your material uses a custom shader, the shader can access 
 40      * if through the Dynacoe_SampleFramebuffer function.
 41      * @param {camera} Camera 
 42      */
 43     this.setFramebufferSource = function(){};
 44 
 45     /**
 46      * Iterates all textures to the next texture frame
 47      */
 48     this.nextTextureFrame = function(){};
 49 
 50 
 51 
 52 
 53 
 54 
 55     /**
 56      * The ambient color of the material.
 57      * @type {color}
 58      */
 59     this.ambient = {};
 60 
 61     /**
 62      * The diffuse color of the material.
 63      * @type {color}
 64      */
 65     this.diffuse = {};
 66 
 67     /** 
 68      * The specular color of the material
 69      * @type {color}
 70      */
 71     this.specular = 0;
 72 
 73 
 74 
 75 
 76     /**
 77      * The amount of specular light that should be allowed.
 78      * @type {Number}
 79      */
 80     this.specularAmount = 0;
 81 
 82     /**
 83      * The amount of diffuse light that should be allowed.
 84      * @type {Number}
 85      */
 86     this.diffuseAmount = 0;
 87 
 88     /**
 89      * The amount of reflected specular light.
 90      * @type {Number}
 91      */
 92     this.shininess = 0;
 93 
 94     /**
 95      * The source logic for the material as a shading program.
 96      * This can either be a {@link sandboxe.material.coreProgram} or 
 97      * a {@link shader} program object with custom logic.
 98      * @type {Number|shader}
 99      */
100     this.program = 0;
101 
102 
103 
104     /**
105      * Data that depends on the drawing mode. In implementations
106      * that support shaders, this can be used as you see fit.
107      * This property should be overwritten to update the user data.
108      * Up to 32 values can be given to the program.
109      * @type {Array}
110      */
111     this.userData = 0;
112 
113 
114 
115 
116     return this;
117 }
118