Skip to content

Commit 0f96dfb

Browse files
committed
Fix missing getLocalMatrix interface function on mesh, model, light and view elements.
1 parent c62d0b9 commit 0f96dfb

File tree

4 files changed

+143
-54
lines changed

4 files changed

+143
-54
lines changed

src/interface/configuration.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ classInfo['group'] = {
179179
onkeydown: {a: handlers.EventAttributeHandler},
180180
onkeyup: {a: handlers.EventAttributeHandler},
181181
getWorldMatrix: {m: methods.XML3DGraphTypeGetWorldMatrix},
182-
getLocalMatrix: {m: methods.groupGetLocalMatrix},
182+
getLocalMatrix: {m: methods.XML3DGraphTypeGetLocalMatrix},
183183
getWorldBoundingBox : {m: methods.getWorldBoundingBox},
184184
getLocalBoundingBox : {m: methods.getLocalBoundingBox},
185185
transform: {a: handlers.StringAttributeHandler},
@@ -209,6 +209,7 @@ classInfo['mesh'] = {
209209
transform: {a: handlers.StringAttributeHandler},
210210
material: {a: handlers.StringAttributeHandler},
211211
getWorldMatrix: {m: methods.XML3DGraphTypeGetWorldMatrix},
212+
getLocalMatrix: {m: methods.XML3DGraphTypeGetLocalMatrix},
212213
getWorldBoundingBox : {m: methods.getWorldBoundingBox},
213214
getLocalBoundingBox : {m: methods.getLocalBoundingBox},
214215
getOutputNames: {m: methods.meshGetOutputNames},
@@ -237,6 +238,7 @@ classInfo['model'] = {
237238
complete: {p: properties.AssetComplete},
238239
progressLevel: {p: properties.AssetProgressLevel},
239240
getWorldMatrix: {m: methods.XML3DGraphTypeGetWorldMatrix},
241+
getLocalMatrix: {m: methods.XML3DGraphTypeGetLocalMatrix},
240242
getWorldBoundingBox : {m: methods.getWorldBoundingBox},
241243
getLocalBoundingBox : {m: methods.getLocalBoundingBox},
242244
src: {a: handlers.StringAttributeHandler},
@@ -290,6 +292,7 @@ classInfo['light'] = {
290292
onkeyup: {a: handlers.EventAttributeHandler},
291293
global: {a: handlers.BoolAttributeHandler, params: false},
292294
getWorldMatrix: {m: methods.XML3DGraphTypeGetWorldMatrix},
295+
getLocalMatrix: {m: methods.XML3DGraphTypeGetLocalMatrix},
293296
onload: {a: handlers.EventAttributeHandler},
294297
onprogress: {a: handlers.EventAttributeHandler},
295298
complete: {p: properties.XML3DNestedDataContainerTypeComplete},
@@ -525,6 +528,7 @@ classInfo['view'] = {
525528
onkeydown: {a: handlers.EventAttributeHandler},
526529
onkeyup: {a: handlers.EventAttributeHandler},
527530
getWorldMatrix: {m: methods.XML3DGraphTypeGetWorldMatrix},
531+
getLocalMatrix: {m: methods.XML3DGraphTypeGetLocalMatrix},
528532
getProjectionMatrix:{m: methods.viewGetProjectionMatrix},
529533
getViewMatrix: {m: methods.viewGetViewMatrix}
530534
};

src/interface/methods.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,6 @@ methods.xml3dGenerateRay = function(x, y) {
7171
return new XML3D.Ray();
7272
};
7373

74-
methods.groupGetLocalMatrix = function() {
75-
XML3D.flushDOMChanges();
76-
var adapters = this._configured.adapters || {};
77-
for ( var adapter in adapters) {
78-
if (adapters[adapter].getLocalMatrix) {
79-
return adapters[adapter].getLocalMatrix();
80-
}
81-
}
82-
return new Mat4();
83-
};
84-
8574
/**
8675
* return the bounding box of the owning space in world space
8776
*/
@@ -137,6 +126,17 @@ methods.XML3DGraphTypeGetWorldMatrix = function() {
137126
return new Mat4();
138127
};
139128

129+
methods.XML3DGraphTypeGetLocalMatrix = function() {
130+
XML3D.flushDOMChanges();
131+
var adapters = this._configured.adapters || {};
132+
for ( var adapter in adapters) {
133+
if (adapters[adapter].getLocalMatrix) {
134+
return adapters[adapter].getLocalMatrix();
135+
}
136+
}
137+
return new Mat4();
138+
};
139+
140140
methods.videoPlay = function() {
141141
sendAdapterEvent(this, {play: []});
142142
};

tests/elements-generated.js

Lines changed: 95 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module("Generated Element interface tests", {
44
});
55

66
test("<xml3d> interface test", function() {
7-
var e = document.createElementNS(XML3D.xml3dNS, "xml3d");
8-
ok(e, "xml3d exits");
7+
var e = document.createElement("xml3d");
8+
ok(e, "xml3d exists");
99
equal(typeof e.className, "string", "className is of type 'string'");
1010
equal(typeof e.style, "object", "style is of type 'object'");
1111
equal(typeof e.id, "string", "id is of type 'string'");
@@ -30,8 +30,8 @@ test("<xml3d> interface test", function() {
3030
equal(typeof e.view, "string", "view is of type 'string'");
3131
});
3232
test("<data> interface test", function() {
33-
var e = document.createElementNS(XML3D.xml3dNS, "data");
34-
ok(e, "data exits");
33+
var e = document.createElement("data");
34+
ok(e, "data exists");
3535
equal(typeof e.className, "string", "className is of type 'string'");
3636
equal(typeof e.style, "object", "style is of type 'object'");
3737
equal(typeof e.id, "string", "id is of type 'string'");
@@ -43,15 +43,15 @@ test("<data> interface test", function() {
4343
equal(typeof e.src, "string", "src is of type 'string'");
4444
});
4545
test("<defs> interface test", function() {
46-
var e = document.createElementNS(XML3D.xml3dNS, "defs");
47-
ok(e, "defs exits");
46+
var e = document.createElement("defs");
47+
ok(e, "defs exists");
4848
equal(typeof e.className, "string", "className is of type 'string'");
4949
equal(typeof e.style, "object", "style is of type 'object'");
5050
equal(typeof e.id, "string", "id is of type 'string'");
5151
});
5252
test("<group> interface test", function() {
53-
var e = document.createElementNS(XML3D.xml3dNS, "group");
54-
ok(e, "group exits");
53+
var e = document.createElement("group");
54+
ok(e, "group exists");
5555
equal(typeof e.className, "string", "className is of type 'string'");
5656
equal(typeof e.style, "object", "style is of type 'object'");
5757
equal(typeof e.id, "string", "id is of type 'string'");
@@ -73,8 +73,8 @@ test("<group> interface test", function() {
7373
equal(typeof e.material, "string", "material is of type 'string'");
7474
});
7575
test("<mesh> interface test", function() {
76-
var e = document.createElementNS(XML3D.xml3dNS, "mesh");
77-
ok(e, "mesh exits");
76+
var e = document.createElement("mesh");
77+
ok(e, "mesh exists");
7878
equal(typeof e.className, "string", "className is of type 'string'");
7979
equal(typeof e.style, "object", "style is of type 'object'");
8080
equal(typeof e.id, "string", "id is of type 'string'");
@@ -91,6 +91,7 @@ test("<mesh> interface test", function() {
9191
equal(typeof e.type, "string", "type is of type 'string'");
9292
equal(typeof e.compute, "string", "compute is of type 'string'");
9393
equal(typeof e.getWorldMatrix, "function", "getWorldMatrix is of type 'function'");
94+
equal(typeof e.getLocalMatrix, "function", "getLocalMatrix is of type 'function'");
9495
equal(typeof e.getLocalBoundingBox, "function", "getLocalBoundingBox is of type 'function'");
9596
equal(typeof e.getWorldBoundingBox, "function", "getWorldBoundingBox is of type 'function'");
9697
equal(typeof e.getOutputNames, "function", "getOutputNames is of type 'function'");
@@ -99,8 +100,8 @@ test("<mesh> interface test", function() {
99100
equal(typeof e.src, "string", "src is of type 'string'");
100101
});
101102
test("<transform> interface test", function() {
102-
var e = document.createElementNS(XML3D.xml3dNS, "transform");
103-
ok(e, "transform exits");
103+
var e = document.createElement("transform");
104+
ok(e, "transform exists");
104105
equal(typeof e.className, "string", "className is of type 'string'");
105106
equal(typeof e.style, "object", "style is of type 'object'");
106107
equal(typeof e.id, "string", "id is of type 'string'");
@@ -111,8 +112,8 @@ test("<transform> interface test", function() {
111112
equal(typeof e.scaleOrientation, "object", "scaleOrientation is of type 'object'");
112113
});
113114
test("<material> interface test", function() {
114-
var e = document.createElementNS(XML3D.xml3dNS, "material");
115-
ok(e, "material exits");
115+
var e = document.createElement("material");
116+
ok(e, "material exists");
116117
equal(typeof e.className, "string", "className is of type 'string'");
117118
equal(typeof e.style, "object", "style is of type 'object'");
118119
equal(typeof e.id, "string", "id is of type 'string'");
@@ -124,8 +125,8 @@ test("<material> interface test", function() {
124125
equal(typeof e.src, "string", "src is of type 'string'");
125126
});
126127
test("<light> interface test", function() {
127-
var e = document.createElementNS(XML3D.xml3dNS, "light");
128-
ok(e, "light exits");
128+
var e = document.createElement("light");
129+
ok(e, "light exists");
129130
equal(typeof e.className, "string", "className is of type 'string'");
130131
equal(typeof e.style, "object", "style is of type 'object'");
131132
equal(typeof e.id, "string", "id is of type 'string'");
@@ -141,21 +142,22 @@ test("<light> interface test", function() {
141142
equal(typeof e.onkeyup, "object", "onkeyup is of type 'object'");
142143
equal(typeof e.global, "boolean", "global is of type 'boolean'");
143144
equal(typeof e.getWorldMatrix, "function", "getWorldMatrix is of type 'function'");
145+
equal(typeof e.getLocalMatrix, "function", "getLocalMatrix is of type 'function'");
144146
equal(typeof e.model, "string", "model is of type 'string'");
145147
});
146148

147149
test("<script> interface test", function() {
148-
var e = document.createElementNS(XML3D.xml3dNS, "script");
149-
ok(e, "script exits");
150+
var e = document.createElement("script");
151+
ok(e, "script exists");
150152
equal(typeof e.className, "string", "className is of type 'string'");
151153
equal(typeof e.style, "object", "style is of type 'object'");
152154
equal(typeof e.id, "string", "id is of type 'string'");
153155
equal(typeof e.src, "string", "src is of type 'string'");
154156
equal(typeof e.type, "string", "type is of type 'string'");
155157
});
156158
test("<float> interface test", function() {
157-
var e = document.createElementNS(XML3D.xml3dNS, "float");
158-
ok(e, "float exits");
159+
var e = document.createElement("float");
160+
ok(e, "float exists");
159161
equal(typeof e.className, "string", "className is of type 'string'");
160162
equal(typeof e.style, "object", "style is of type 'object'");
161163
equal(typeof e.id, "string", "id is of type 'string'");
@@ -165,8 +167,8 @@ test("<float> interface test", function() {
165167
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
166168
});
167169
test("<float2> interface test", function() {
168-
var e = document.createElementNS(XML3D.xml3dNS, "float2");
169-
ok(e, "float2 exits");
170+
var e = document.createElement("float2");
171+
ok(e, "float2 exists");
170172
equal(typeof e.className, "string", "className is of type 'string'");
171173
equal(typeof e.style, "object", "style is of type 'object'");
172174
equal(typeof e.id, "string", "id is of type 'string'");
@@ -176,8 +178,8 @@ test("<float2> interface test", function() {
176178
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
177179
});
178180
test("<float3> interface test", function() {
179-
var e = document.createElementNS(XML3D.xml3dNS, "float3");
180-
ok(e, "float3 exits");
181+
var e = document.createElement("float3");
182+
ok(e, "float3 exists");
181183
equal(typeof e.className, "string", "className is of type 'string'");
182184
equal(typeof e.style, "object", "style is of type 'object'");
183185
equal(typeof e.id, "string", "id is of type 'string'");
@@ -187,8 +189,8 @@ test("<float3> interface test", function() {
187189
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
188190
});
189191
test("<float4> interface test", function() {
190-
var e = document.createElementNS(XML3D.xml3dNS, "float4");
191-
ok(e, "float4 exits");
192+
var e = document.createElement("float4");
193+
ok(e, "float4 exists");
192194
equal(typeof e.className, "string", "className is of type 'string'");
193195
equal(typeof e.style, "object", "style is of type 'object'");
194196
equal(typeof e.id, "string", "id is of type 'string'");
@@ -198,8 +200,8 @@ test("<float4> interface test", function() {
198200
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
199201
});
200202
test("<float4x4> interface test", function() {
201-
var e = document.createElementNS(XML3D.xml3dNS, "float4x4");
202-
ok(e, "float4x4 exits");
203+
var e = document.createElement("float4x4");
204+
ok(e, "float4x4 exists");
203205
equal(typeof e.className, "string", "className is of type 'string'");
204206
equal(typeof e.style, "object", "style is of type 'object'");
205207
equal(typeof e.id, "string", "id is of type 'string'");
@@ -209,8 +211,8 @@ test("<float4x4> interface test", function() {
209211
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
210212
});
211213
test("<int> interface test", function() {
212-
var e = document.createElementNS(XML3D.xml3dNS, "int");
213-
ok(e, "int exits");
214+
var e = document.createElement("int");
215+
ok(e, "int exists");
214216
equal(typeof e.className, "string", "className is of type 'string'");
215217
equal(typeof e.style, "object", "style is of type 'object'");
216218
equal(typeof e.id, "string", "id is of type 'string'");
@@ -220,8 +222,8 @@ test("<int> interface test", function() {
220222
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
221223
});
222224
test("<int4> interface test", function() {
223-
var e = document.createElementNS(XML3D.xml3dNS, "int4");
224-
ok(e, "int4 exits");
225+
var e = document.createElement("int4");
226+
ok(e, "int4 exists");
225227
equal(typeof e.className, "string", "className is of type 'string'");
226228
equal(typeof e.style, "object", "style is of type 'object'");
227229
equal(typeof e.id, "string", "id is of type 'string'");
@@ -231,8 +233,8 @@ test("<int4> interface test", function() {
231233
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
232234
});
233235
test("<bool> interface test", function() {
234-
var e = document.createElementNS(XML3D.xml3dNS, "bool");
235-
ok(e, "bool exits");
236+
var e = document.createElement("bool");
237+
ok(e, "bool exists");
236238
equal(typeof e.className, "string", "className is of type 'string'");
237239
equal(typeof e.style, "object", "style is of type 'object'");
238240
equal(typeof e.id, "string", "id is of type 'string'");
@@ -242,8 +244,8 @@ test("<bool> interface test", function() {
242244
equal(typeof e.setScriptValue, "function", "setScriptValue is of type 'function'");
243245
});
244246
test("<texture> interface test", function() {
245-
var e = document.createElementNS(XML3D.xml3dNS, "texture");
246-
ok(e, "texture exits");
247+
var e = document.createElement("texture");
248+
ok(e, "texture exists");
247249
equal(typeof e.className, "string", "className is of type 'string'");
248250
equal(typeof e.style, "object", "style is of type 'object'");
249251
equal(typeof e.id, "string", "id is of type 'string'");
@@ -256,16 +258,16 @@ test("<texture> interface test", function() {
256258
equal(typeof e.anisotropy, "string", "anisotropy is of type 'string'");
257259
});
258260
test("<img> interface test", function() {
259-
var e = document.createElementNS(XML3D.xml3dNS, "img");
260-
ok(e, "img exits");
261+
var e = document.createElement("img");
262+
ok(e, "img exists");
261263
equal(typeof e.className, "string", "className is of type 'string'");
262264
equal(typeof e.style, "object", "style is of type 'object'");
263265
equal(typeof e.id, "string", "id is of type 'string'");
264266
equal(typeof e.src, "string", "src is of type 'string'");
265267
});
266268
test("<video> interface test", function() {
267-
var e = document.createElementNS(XML3D.xml3dNS, "video");
268-
ok(e, "video exits");
269+
var e = document.createElement("video");
270+
ok(e, "video exists");
269271
equal(typeof e.className, "string", "className is of type 'string'");
270272
equal(typeof e.style, "object", "style is of type 'object'");
271273
equal(typeof e.id, "string", "id is of type 'string'");
@@ -275,8 +277,8 @@ test("<video> interface test", function() {
275277
equal(typeof e.pause, "function", "pause is of type 'function'");
276278
});
277279
test("<view> interface test", function() {
278-
var e = document.createElementNS(XML3D.xml3dNS, "view");
279-
ok(e, "view exits");
280+
var e = document.createElement("view");
281+
ok(e, "view exists");
280282
equal(typeof e.className, "string", "className is of type 'string'");
281283
equal(typeof e.style, "object", "style is of type 'object'");
282284
equal(typeof e.id, "string", "id is of type 'string'");
@@ -291,5 +293,56 @@ test("<view> interface test", function() {
291293
equal(typeof e.onkeydown, "object", "onkeydown is of type 'object'");
292294
equal(typeof e.onkeyup, "object", "onkeyup is of type 'object'");
293295
equal(typeof e.getWorldMatrix, "function", "getWorldMatrix is of type 'function'");
296+
equal(typeof e.getLocalMatrix, "function", "getLocalMatrix is of type 'function'");
294297
equal(typeof e.getViewMatrix, "function", "getViewMatrix is of type 'function'");
295298
});
299+
test("&lt;model&gt; interface test", function() {
300+
var e = document.createElement("model");
301+
ok(e, "model exists");
302+
equal(typeof e.className, "string", "className is of type 'string'");
303+
equal(typeof e.style, "object", "style is of type 'object'");
304+
equal(typeof e.id, "string", "id is of type 'string'");
305+
equal(typeof e.onclick, "object", "onclick is of type 'object'");
306+
equal(typeof e.ondblclick, "object", "ondblclick is of type 'object'");
307+
equal(typeof e.onmousedown, "object", "onmousedown is of type 'object'");
308+
equal(typeof e.onmouseup, "object", "onmouseup is of type 'object'");
309+
equal(typeof e.onmouseover, "object", "onmouseover is of type 'object'");
310+
equal(typeof e.onmousemove, "object", "onmousemove is of type 'object'");
311+
equal(typeof e.onmouseout, "object", "onmouseout is of type 'object'");
312+
equal(typeof e.onkeypress, "object", "onkeypress is of type 'object'");
313+
equal(typeof e.onkeydown, "object", "onkeydown is of type 'object'");
314+
equal(typeof e.onkeyup, "object", "onkeyup is of type 'object'");
315+
equal(typeof e.getWorldMatrix, "function", "getWorldMatrix is of type 'function'");
316+
equal(typeof e.getLocalMatrix, "function", "getLocalMatrix is of type 'function'");
317+
equal(typeof e.getLocalBoundingBox, "function", "getLocalBoundingBox is of type 'function'");
318+
equal(typeof e.getWorldBoundingBox, "function", "getWorldBoundingBox is of type 'function'");
319+
});
320+
test("&lt;asset&gt; interface test", function() {
321+
var e = document.createElement("asset");
322+
ok(e, "asset exists");
323+
equal(typeof e.className, "string", "className is of type 'string'");
324+
equal(typeof e.style, "object", "style is of type 'object'");
325+
equal(typeof e.id, "string", "id is of type 'string'");
326+
equal(typeof e.src, "string", "src is of type 'string'");
327+
});
328+
test("&lt;assetdata&gt; interface test", function() {
329+
var e = document.createElement("assetdata");
330+
ok(e, "assetdata exists");
331+
equal(typeof e.className, "string", "className is of type 'string'");
332+
equal(typeof e.style, "object", "style is of type 'object'");
333+
equal(typeof e.id, "string", "id is of type 'string'");
334+
equal(typeof e.name, "string", "name is of type 'string'");
335+
equal(typeof e.includes, "string", "includes is of type 'string'");
336+
});
337+
test("&lt;assetmesh&gt; interface test", function() {
338+
var e = document.createElement("assetmesh");
339+
ok(e, "assetmesh exists");
340+
equal(typeof e.className, "string", "className is of type 'string'");
341+
equal(typeof e.style, "object", "style is of type 'object'");
342+
equal(typeof e.id, "string", "id is of type 'string'");
343+
equal(typeof e.name, "string", "name is of type 'string'");
344+
equal(typeof e.includes, "string", "includes is of type 'string'");
345+
equal(typeof e.type, "string", "type is of type 'string'");
346+
equal(typeof e.material, "string", "material is of type 'string'");
347+
equal(typeof e.transform, "string", "transform is of type 'string'");
348+
});

0 commit comments

Comments
 (0)