/
modelimpl.js
110 lines (84 loc) · 2.98 KB
/
modelimpl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Model implementation mixin.
// Defines all the properties and methods that a model must implement.
var ModelImpl = (function () {
// Create the required variables in the object.
function setupImpl(parser, textureMap) {
this.name = "";
this.meshes = [];
this.sequences = [];
this.textures = [];
this.cameras = [];
this.boundingShapes = [];
this.attachments = [];
this.textureMap = textureMap;
this.setup(parser, textureMap);
this.setupShaders(parser);
}
function setup(parser, textureMap) {
}
function setupShaders(parser) {
}
function render(instance, context) {
}
function renderEmiters(instance, context) {
}
function renderBoundingShapes(instance, context) {
}
function renderColor(instance, color) {
}
function getName() {
return this.name;
}
function getAttachment(id) {
return this.attachments[id];
}
function getCamera(id) {
return this.cameras[id];
}
function overrideTexture(path, override) {
this.textureMap[path] = override;
}
function getTextureMap() {
var textureMap = Object.copy(this.textureMap);
// Avoid reporting the team color textures, since they are internal.
// Is there any nicer way to do this?
delete textureMap["replaceabletextures/teamcolor/teamcolor00.blp"];
delete textureMap["replaceabletextures/teamglow/teamglow00.blp"];
return textureMap;
}
function getSequences() {
return getNamesFromObjects(this.sequences);
}
function getCameras() {
return getNamesFromObjects(this.cameras);
}
function getBoundingShapes() {
return getNamesFromObjects(this.boundingShapes);
}
function getAttachments() {
return getNamesFromObjects(this.attachments);
}
function getMeshCount() {
return this.meshes.length;
}
return function () {
if (!this.setupImpl) { this.setupImpl = setupImpl; }
if (!this.setup) { this.setup = setup; }
if (!this.setupShaders) { this.setupShaders = setupShaders; }
if (!this.render) { this.render = render; }
if (!this.renderEmiters) { this.renderEmiters = renderEmiters; }
if (!this.renderBoundingShapes) { this.renderBoundingShapes = renderBoundingShapes; }
if (!this.renderColor) { this.renderColor = renderColor; }
if (!this.getName) { this.getName = getName; }
if (!this.getAttachment) { this.getAttachment = getAttachment; }
if (!this.getCamera) { this.getCamera = getCamera; }
if (!this.overrideTexture) { this.overrideTexture = overrideTexture; }
if (!this.getTextureMap) { this.getTextureMap = getTextureMap; }
if (!this.getSequences) { this.getSequences = getSequences; }
if (!this.getCameras) { this.getCameras = getCameras; }
if (!this.getBoundingShapes) { this.getBoundingShapes = getBoundingShapes; }
if (!this.getAttachments) { this.getAttachments = getAttachments; }
if (!this.getMeshCount) { this.getMeshCount = getMeshCount; }
return this;
};
}());