UNPKG

odin

Version:

Node.js Canvas/WebGL Javascript Game Framework

137 lines (92 loc) 4.08 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: core/components/mesh_filter.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: core/components/mesh_filter.js</h1> <section> <article> <pre class="prettyprint source"><code>if (typeof define !== "function") { var define = require("amdefine")(module); } define([ "odin/core/assets/assets", "odin/core/components/component" ], function(Assets, Component) { "use strict"; /** * @class MeshFilter * @extends Component * @brief base class for handling meshes * @param Object options */ function MeshFilter(opts) { opts || (opts = {}); Component.call(this, "MeshFilter", opts); /** * @property Mesh mesh * @memberof MeshFilter */ this.mesh = opts.mesh != undefined ? opts.mesh : undefined; /** * @property Material material * @memberof MeshFilter */ this.material = opts.material != undefined ? opts.material : undefined; } Component.extend(MeshFilter); MeshFilter.prototype.copy = function(other) { this.mesh = other.mesh; this.material = other.material; return this; }; MeshFilter.prototype.clear = function() { Component.prototype.clear.call(this); this.mesh = undefined; this.material = undefined; return this; }; MeshFilter.prototype.sort = function(a, b) { return a.mesh === b.mesh ? -1 : 1; }; MeshFilter.prototype.toJSON = function(json) { json = Component.prototype.toJSON.call(this, json); json.mesh = this.mesh ? this.mesh.name : undefined; json.material = this.material ? this.material.name : undefined; return json; }; MeshFilter.prototype.fromJSON = function(json) { Component.prototype.fromJSON.call(this, json); this.mesh = json.mesh ? Assets.get(json.mesh) : undefined; this.material = json.material ? Assets.get(json.material) : undefined; return this; }; return MeshFilter; } ); </code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Canvas.html">Canvas</a></li><li><a href="GUIObject.html">GUIObject</a></li><li><a href="MeshFilter.html">MeshFilter</a></li><li><a href="Odin.html">Odin</a></li><li><a href="Odin.Class.html">Class</a></li><li><a href="Odin.EventEmitter.html">EventEmitter</a></li><li><a href="Odin.GameObject.html">GameObject</a></li><li><a href="Odin.Scene.html">Scene</a></li><li><a href="P2Contact.html">P2Contact</a></li><li><a href="P2Equation.html">P2Equation</a></li><li><a href="P2Friction.html">P2Friction</a></li><li><a href="P2Solver.html">P2Solver</a></li><li><a href="ParticleSystem.html">ParticleSystem</a></li><li><a href="Renderer.html">Renderer</a></li><li><a href="SpriteAnimation.html">SpriteAnimation</a></li><li><a href="WebGLRenderer.html">WebGLRenderer</a></li><li><a href="WebGLRenderer2D.html">WebGLRenderer2D</a></li></ul> </nav> <br clear="both"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Feb 24 2014 16:15:46 GMT-0600 (CST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>