(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/// <reference path="../../typescript/typescriptAPI/TypeScriptAPIPlugin.d.ts" />

SupCore.system.registerPlugin("typescriptAPI", "Sup.Model", {
    code: "namespace Sup { export class Model extends Asset {} }",
    defs: "declare namespace Sup { class Model extends Asset { dummyModelMember; } }"
});
SupCore.system.registerPlugin("typescriptAPI", "ModelRenderer", {
    code: "namespace Sup {\r\n  let materialTypes = [\"basic\", \"phong\", \"shader\"];\r\n\r\n  export class ModelRenderer extends Sup.ActorComponent {\r\n    constructor(actor: Actor, pathOrAsset?: string|Model, materialIndex?: number, shaderPathOrAsset?: string|Shader) {\r\n      super(actor);\r\n      this.__inner = new SupEngine.componentClasses.ModelRenderer(this.actor.__inner);\r\n      if (pathOrAsset != null) this.setModel(pathOrAsset, materialIndex, shaderPathOrAsset);\r\n      this.__inner.__outer = this;\r\n      this.actor.modelRenderer = this;\r\n    }\r\n    destroy() {\r\n      this.actor.modelRenderer = null;\r\n      super.destroy();\r\n    }\r\n\r\n    getModel() { return this.__inner.asset.__outer }\r\n    setModel(pathOrAsset: string|Model, materialIndex?: number, shaderPathOrAsset?: string|Shader) {\r\n      let material: string;\r\n      if (materialIndex != null) material = materialTypes[materialIndex];\r\n\r\n      if (material === \"shader\" && shaderPathOrAsset == null) {\r\n        throw new Error(`Shader asset is missing when setting model on actor named \"${this.actor.getName()}\"`);\r\n      }\r\n\r\n      let modelAsset: Model;\r\n      if (pathOrAsset != null) {\r\n        modelAsset = (typeof pathOrAsset === \"string\") ? get(pathOrAsset, Model) : <Model>pathOrAsset;\r\n        this.__inner.opacity = modelAsset.__inner.opacity;\r\n      }\r\n      let shaderAsset: Shader;\r\n      if (shaderPathOrAsset != null)\r\n        shaderAsset = (typeof shaderPathOrAsset === \"string\") ? get(shaderPathOrAsset, Shader) : <Shader>shaderPathOrAsset;\r\n\r\n      this.__inner.setModel((modelAsset != null) ? modelAsset.__inner : null, material, (shaderAsset != null) ? shaderAsset.__inner : null);\r\n      return this;\r\n    }\r\n    \r\n    getMaterialType() { return materialTypes.indexOf(this.__inner.materialType); }\r\n    getShader() { return this.__inner.materialType === \"shader\" ? this.__inner.shaderAsset.__outer : null; }\r\n    uniforms = new Sup.ShaderUniforms(this);\r\n\r\n    getOpacity() { return this.__inner.opacity; }\r\n    setOpacity(opacity) { this.__inner.setOpacity(opacity); return this; }\r\n    getColor() { return new Color(this.__inner.color.r, this.__inner.color.g, this.__inner.color.b); }\r\n    setColor(r, g, b) {\r\n      if (g == null && b == null) {\r\n        let color = r;\r\n        this.__inner.setColor(color.r, color.g, color.b);\r\n      } else this.__inner.setColor(r, g, b);\r\n      return this;\r\n    }\r\n    getBoneTransform(name) {\r\n      var data = this.__inner.getBoneTransform(name);\r\n      if (data != null) {\r\n        var position = new Math.Vector3(data.position.x, data.position.y, data.position.z);\r\n        var orientation = new Math.Quaternion(data.orientation.x, data.orientation.y, data.orientation.z, data.orientation.w);\r\n        var scale = new Math.Vector3(data.scale.x, data.scale.y, data.scale.z);\r\n\r\n        return { position, orientation, scale }\r\n      } else {\r\n        return null\r\n      }\r\n    }\r\n\r\n    setAnimation(animationName, looping) { this.__inner.setAnimation(animationName, looping); return this }\r\n    getAnimation() { return this.__inner.getAnimation() }\r\n    setAnimationTime(time) { this.__inner.setAnimationTime(time); return this }\r\n    getAnimationTime() { return this.__inner.getAnimationTime() }\r\n    getAnimationDuration() { return this.__inner.getAnimationDuration() }\r\n\r\n    isAnimationPlaying() { return this.__inner.isAnimationPlaying }\r\n    playAnimation(looping) { this.__inner.playAnimation(looping); return this }\r\n    pauseAnimation() { this.__inner.pauseAnimation(); return this }\r\n    stopAnimation() { this.__inner.stopAnimation(); return this }\r\n  }\r\n\r\n  export namespace ModelRenderer {\r\n    export enum MaterialType { Basic, Phong, Shader };\r\n  }\r\n}\r\n",
    defs: "declare namespace Sup {\r\n  class ModelRenderer extends ActorComponent {\r\n    constructor(actor: Actor, pathOrAsset?: string|Model);\r\n    constructor(actor: Actor, pathOrAsset: string|Model, materialType?: ModelRenderer.MaterialType, shaderPathOrAsset?: string|Shader);\r\n\r\n    getModel(): Model;\r\n    setModel(pathOrAsset: string|Model): ModelRenderer;\r\n    setModel(pathOrAsset: string|Model, materialType?: ModelRenderer.MaterialType, shaderPathOrAsset?: string|Shader): ModelRenderer;\r\n\r\n    getMaterialType(): ModelRenderer.MaterialType;\r\n    getShader(): Shader;\r\n    uniforms: Sup.ShaderUniforms;\r\n\r\n    getOpacity(): number;\r\n    setOpacity(opacity: number): ModelRenderer;\r\n    getColor(): Color;\r\n    setColor(color: Color): ModelRenderer;\r\n    setColor(r: number, g: number, b: number): ModelRenderer;\r\n    getBoneTransform(name: string): {position: Sup.Math.Vector3; orientation: Sup.Math.Quaternion; scale: Sup.Math.Vector3};\r\n\r\n    getAnimation(): string;\r\n    setAnimation(animationName: string, looping?: boolean): ModelRenderer;\r\n    setAnimationTime(time: number): ModelRenderer;\r\n    getAnimationTime(): number;\r\n    getAnimationDuration(): number;\r\n\r\n    isAnimationPlaying(): boolean;\r\n    playAnimation(looping?: boolean): ModelRenderer;\r\n    pauseAnimation(): ModelRenderer;\r\n    stopAnimation(): ModelRenderer;\r\n  }\r\n\r\n  namespace ModelRenderer {\r\n    enum MaterialType { Basic, Phong, Shader }\r\n  }\r\n}\r\n",
    exposeActorComponent: { propertyName: "modelRenderer", className: "Sup.ModelRenderer" }
});

},{}]},{},[1]);
