summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPasi Keranen <pasi.keranen@digia.com>2015-02-10 14:44:38 +0200
committerPasi Keränen <pasi.keranen@digia.com>2015-02-11 20:55:37 +0000
commit2ef3a781bacb62a3987c71a91dcc43971f604255 (patch)
treef19f41995bb6e4087fb72fb9b416c80c0d177150
parent1aa4c4b3300c877db61527e9a3d77966f1d4f266 (diff)
Moving to V4VM TypedArrays in Qt 5.5 dev.
This commit breaks compatibility with Qt 5.4 and earlier versions. It removes the temporary QObject based TypedArrays and moves the code to use the native QV4::TypedArray support in Qt 5.5. This allows the implementation now to also add support for compressed textures and support all getParameter() values. Change-Id: I637083e8ebad46b77617ca4095cefaa5aab48b0b Reviewed-by: Pasi Keränen <pasi.keranen@digia.com>
-rw-r--r--examples/canvas3d/canvasswitch/qml/canvasswitch/cube.js6
-rw-r--r--examples/canvas3d/canvasswitch/qml/canvasswitch/triangle.js2
-rw-r--r--examples/canvas3d/framebuffer/qml/framebuffer/framebuffer.js10
-rw-r--r--examples/canvas3d/interaction/qml/interaction/interaction.js8
-rw-r--r--examples/canvas3d/jsonmodels/jsonmodels.js8
-rw-r--r--examples/canvas3d/plasmaeffects/qml/plasmaeffects/plasmaeffects.js12
-rw-r--r--examples/canvas3d/pureqml/cube.js6
-rw-r--r--examples/canvas3d/textureandlight/qml/textureandlight/textureandlight.js10
-rw-r--r--examples/canvas3d/texturedcube/qml/texturedcube/texturedcube.js8
-rw-r--r--src/abstractobject3d.cpp2
-rw-r--r--src/abstractobject3d_p.h2
-rw-r--r--src/activeinfo3d.cpp2
-rw-r--r--src/activeinfo3d_p.h2
-rw-r--r--src/arrayutils.cpp3
-rw-r--r--src/arrayutils_p.h150
-rw-r--r--src/buffer3d.cpp3
-rw-r--r--src/buffer3d_p.h2
-rw-r--r--src/canvas3d.cpp6
-rw-r--r--src/canvas3d_p.h2
-rw-r--r--src/canvasglstatedump.cpp2
-rw-r--r--src/canvasglstatedump_p.h2
-rw-r--r--src/canvasrendernode.cpp2
-rw-r--r--src/canvasrendernode_p.h2
-rw-r--r--src/context3d.cpp814
-rw-r--r--src/context3d_p.h38
-rw-r--r--src/contextattributes.cpp2
-rw-r--r--src/contextattributes_p.h2
-rw-r--r--src/contextextensions.cpp2
-rw-r--r--src/contextextensions_p.h2
-rw-r--r--src/enumtostringmap.cpp2
-rw-r--r--src/enumtostringmap_p.h2
-rw-r--r--src/framebuffer3d.cpp2
-rw-r--r--src/framebuffer3d_p.h2
-rw-r--r--src/plugins.qmltypes430
-rw-r--r--src/program3d.cpp2
-rw-r--r--src/program3d_p.h2
-rw-r--r--src/qcanvas3d_plugin.cpp57
-rw-r--r--src/qcanvas3d_plugin.h34
-rw-r--r--src/renderbuffer3d.cpp2
-rw-r--r--src/renderbuffer3d_p.h2
-rw-r--r--src/shader3d.cpp2
-rw-r--r--src/shader3d_p.h2
-rw-r--r--src/shaderprecisionformat.cpp2
-rw-r--r--src/shaderprecisionformat_p.h2
-rw-r--r--src/src.pro32
-rw-r--r--src/teximage3d.cpp2
-rw-r--r--src/teximage3d_p.h2
-rw-r--r--src/texture3d.cpp2
-rw-r--r--src/texture3d_p.h2
-rw-r--r--src/typedarray/arraybuffer.cpp181
-rw-r--r--src/typedarray/arraybuffer_p.h101
-rw-r--r--src/typedarray/arraybufferview.cpp125
-rw-r--r--src/typedarray/arraybufferview_p.h101
-rw-r--r--src/typedarray/float32array.cpp253
-rw-r--r--src/typedarray/float32array_p.h86
-rw-r--r--src/typedarray/float64array.cpp194
-rw-r--r--src/typedarray/float64array_p.h84
-rw-r--r--src/typedarray/int16array.cpp192
-rw-r--r--src/typedarray/int16array_p.h84
-rw-r--r--src/typedarray/int32array.cpp191
-rw-r--r--src/typedarray/int32array_p.h84
-rw-r--r--src/typedarray/int8array.cpp191
-rw-r--r--src/typedarray/int8array_p.h83
-rw-r--r--src/typedarray/typedarray.cpp126
-rw-r--r--src/typedarray/typedarray_p.h86
-rw-r--r--src/typedarray/typedarrayfactory.cpp579
-rw-r--r--src/typedarray/typedarrayfactory_p.h140
-rw-r--r--src/typedarray/uint16array.cpp195
-rw-r--r--src/typedarray/uint16array_p.h84
-rw-r--r--src/typedarray/uint32array.cpp188
-rw-r--r--src/typedarray/uint32array_p.h86
-rw-r--r--src/typedarray/uint8array.cpp192
-rw-r--r--src/typedarray/uint8array_p.h84
-rw-r--r--src/typedarray/uint8clampedarray.cpp191
-rw-r--r--src/typedarray/uint8clampedarray_p.h83
-rw-r--r--src/uniformlocation.cpp2
-rw-r--r--src/uniformlocation_p.h2
-rw-r--r--sync.profile4
78 files changed, 705 insertions, 4984 deletions
diff --git a/examples/canvas3d/canvasswitch/qml/canvasswitch/cube.js b/examples/canvas3d/canvasswitch/qml/canvasswitch/cube.js
index 47075bc..a2a7b62 100644
--- a/examples/canvas3d/canvasswitch/qml/canvasswitch/cube.js
+++ b/examples/canvas3d/canvasswitch/qml/canvasswitch/cube.js
@@ -140,7 +140,7 @@ function initBuffers() {
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
gl.bufferData(
gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([ // front
+ new Float32Array([ // front
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
@@ -157,7 +157,7 @@ function initBuffers() {
cubeVertexIndexBuffer.name = "cubeVertexIndexBuffer";
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array([// front
+ new Uint16Array([// front
0, 1, 2,
2, 3, 0,
// top
@@ -181,7 +181,7 @@ function initBuffers() {
cubeVertexColorBuffer = gl.createBuffer();
cubeVertexColorBuffer.name = "cubeVertexColorBuffer";
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexColorBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array([// front
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([// front
0.000, 1.000, 0.000,
1.000, 0.000, 1.000,
1.000, 1.000, 0.000,
diff --git a/examples/canvas3d/canvasswitch/qml/canvasswitch/triangle.js b/examples/canvas3d/canvasswitch/qml/canvasswitch/triangle.js
index 6166107..7142358 100644
--- a/examples/canvas3d/canvasswitch/qml/canvasswitch/triangle.js
+++ b/examples/canvas3d/canvasswitch/qml/canvasswitch/triangle.js
@@ -65,7 +65,7 @@ function initGL(canvas) {
buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(
- gl.ARRAY_BUFFER, Arrays.newFloat32Array(
+ gl.ARRAY_BUFFER, new Float32Array(
[-1.0, -1.0,
1.0, -1.0,
-1.0, 1.0
diff --git a/examples/canvas3d/framebuffer/qml/framebuffer/framebuffer.js b/examples/canvas3d/framebuffer/qml/framebuffer/framebuffer.js
index d7af85f..5d7c318 100644
--- a/examples/canvas3d/framebuffer/qml/framebuffer/framebuffer.js
+++ b/examples/canvas3d/framebuffer/qml/framebuffer/framebuffer.js
@@ -241,7 +241,7 @@ function initBuffers()
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
gl.bufferData(
gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([// Front face
+ new Float32Array([// Front face
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
@@ -286,7 +286,7 @@ function initBuffers()
cubeVertexIndexBuffer.name = "cubeVertexIndexBuffer";
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array([
+ new Uint16Array([
0, 1, 2, 0, 2, 3, // front
4, 5, 6, 4, 6, 7, // back
8, 9, 10, 8, 10, 11, // top
@@ -318,7 +318,7 @@ function initBuffers()
var cubeVertexColorBuffer = gl.createBuffer();
cubeVertexColorBuffer.name = "cubeVertexColorBuffer";
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexColorBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array(generatedColors), gl.STATIC_DRAW);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(generatedColors), gl.STATIC_DRAW);
gl.enableVertexAttribArray(vertexColorAttribute);
gl.vertexAttribPointer(vertexColorAttribute, 4, gl.FLOAT, false, 0, 0);
@@ -358,7 +358,7 @@ function initBuffers()
0.0, 1.0,
1.0, 1.0
];
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array(textureCoordinates),
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoordinates),
gl.STATIC_DRAW);
gl.enableVertexAttribArray(textureCoordAttribute);
gl.vertexAttribPointer(textureCoordAttribute, 2, gl.FLOAT, false, 0, 0);
@@ -366,7 +366,7 @@ function initBuffers()
var cubeVerticesNormalBuffer = gl.createBuffer();
cubeVerticesNormalBuffer.name = "cubeVerticesNormalBuffer";
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVerticesNormalBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array([
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
// Front
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
diff --git a/examples/canvas3d/interaction/qml/interaction/interaction.js b/examples/canvas3d/interaction/qml/interaction/interaction.js
index bc4c591..d1aa9e6 100644
--- a/examples/canvas3d/interaction/qml/interaction/interaction.js
+++ b/examples/canvas3d/interaction/qml/interaction/interaction.js
@@ -271,25 +271,25 @@ function handleLoadedModel(jsonObj) {
log(" "+theModel.verticesVBO);
gl.bindBuffer(gl.ARRAY_BUFFER, theModel.verticesVBO);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(modelData.vertices),
+ new Float32Array(modelData.vertices),
gl.STATIC_DRAW);
log(" "+theModel.normalsVBO);
gl.bindBuffer(gl.ARRAY_BUFFER, theModel.normalsVBO);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(modelData.normals),
+ new Float32Array(modelData.normals),
gl.STATIC_DRAW);
log(" "+theModel.texCoordVBO);
gl.bindBuffer(gl.ARRAY_BUFFER, theModel.texCoordVBO);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(modelData.texCoords[0]),
+ new Float32Array(modelData.texCoords[0]),
gl.STATIC_DRAW);
log(" "+theModel.indexVBO);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, theModel.indexVBO);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array(modelData.indices),
+ new Uint16Array(modelData.indices),
gl.STATIC_DRAW);
theModel.count = modelData.indices.length;
diff --git a/examples/canvas3d/jsonmodels/jsonmodels.js b/examples/canvas3d/jsonmodels/jsonmodels.js
index e6440b2..919c327 100644
--- a/examples/canvas3d/jsonmodels/jsonmodels.js
+++ b/examples/canvas3d/jsonmodels/jsonmodels.js
@@ -606,7 +606,7 @@ function fillModel(modelData, model) {
log(" "+model.verticesVBO.name);
gl.bindBuffer(gl.ARRAY_BUFFER, model.verticesVBO);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(modelData.vertices),
+ new Float32Array(modelData.vertices),
gl.STATIC_DRAW);
log(" "+model.normalsVBO.name);
if (stateDumpExt)
@@ -614,19 +614,19 @@ function fillModel(modelData, model) {
gl.bindBuffer(gl.ARRAY_BUFFER, model.normalsVBO);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(modelData.normals),
+ new Float32Array(modelData.normals),
gl.STATIC_DRAW);
log(" "+model.texCoordVBO.name);
gl.bindBuffer(gl.ARRAY_BUFFER, model.texCoordVBO);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(modelData.texCoords[0]),
+ new Float32Array(modelData.texCoords[0]),
gl.STATIC_DRAW);
log(" "+model.indexVBO.name);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, model.indexVBO);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array(modelData.indices),
+ new Uint16Array(modelData.indices),
gl.STATIC_DRAW);
model.count = modelData.indices.length;
diff --git a/examples/canvas3d/plasmaeffects/qml/plasmaeffects/plasmaeffects.js b/examples/canvas3d/plasmaeffects/qml/plasmaeffects/plasmaeffects.js
index 7a5485d..185c74a 100644
--- a/examples/canvas3d/plasmaeffects/qml/plasmaeffects/plasmaeffects.js
+++ b/examples/canvas3d/plasmaeffects/qml/plasmaeffects/plasmaeffects.js
@@ -288,7 +288,7 @@ function initBuffers()
cubeVertexPositionBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([// Front face
+ new Float32Array([// Front face
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
@@ -328,7 +328,7 @@ function initBuffers()
cubeVertexIndexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array([0, 1, 2, 0, 2, 3, // front
+ new Uint16Array([0, 1, 2, 0, 2, 3, // front
4, 5, 6, 4, 6, 7, // back
8, 9, 10, 8, 10, 11, // top
12, 13, 14, 12, 14, 15, // bottom
@@ -355,7 +355,7 @@ function initBuffers()
cubeVertexColorBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexColorBuffer);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(generatedColors),
+ new Float32Array(generatedColors),
gl.STATIC_DRAW);
cubeVerticesTextureCoordBuffer = gl.createBuffer();
@@ -391,13 +391,13 @@ function initBuffers()
0.0, 1.0,
1.0, 1.0];
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array(textureCoordinates),
+ new Float32Array(textureCoordinates),
gl.STATIC_DRAW);
bkgVertexPositionBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, bkgVertexPositionBuffer);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([-1.0, -1.0,
+ new Float32Array([-1.0, -1.0,
1.0, -1.0,
-1.0, 1.0,
-1.0, 1.0,
@@ -408,7 +408,7 @@ function initBuffers()
bkgVerticesTextureCoordBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, bkgVerticesTextureCoordBuffer);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([0.0, 0.0,
+ new Float32Array([0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
0.0, 1.0,
diff --git a/examples/canvas3d/pureqml/cube.js b/examples/canvas3d/pureqml/cube.js
index eaeb688..11dfc91 100644
--- a/examples/canvas3d/pureqml/cube.js
+++ b/examples/canvas3d/pureqml/cube.js
@@ -92,7 +92,7 @@ function initBuffers() {
cubeVertexPositionBuffer.name = "cubeVertexPositionBuffer";
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([ // front
+ new Float32Array([ // front
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
@@ -108,7 +108,7 @@ function initBuffers() {
cubeVertexIndexBuffer.name = "cubeVertexIndexBuffer";
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array([// front
+ new Uint16Array([// front
0, 1, 2,
2, 3, 0,
// top
@@ -132,7 +132,7 @@ function initBuffers() {
cubeVertexColorBuffer.name = "cubeVertexColorBuffer";
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexColorBuffer);
gl.bufferData(gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([// front
+ new Float32Array([// front
0.000, 1.000, 0.000,
0.000, 0.000, 1.000,
1.000, 1.000, 1.000,
diff --git a/examples/canvas3d/textureandlight/qml/textureandlight/textureandlight.js b/examples/canvas3d/textureandlight/qml/textureandlight/textureandlight.js
index 5b4558a..bfe422a 100644
--- a/examples/canvas3d/textureandlight/qml/textureandlight/textureandlight.js
+++ b/examples/canvas3d/textureandlight/qml/textureandlight/textureandlight.js
@@ -167,7 +167,7 @@ function initBuffers()
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
gl.bufferData(
gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([// Front face
+ new Float32Array([// Front face
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
@@ -212,7 +212,7 @@ function initBuffers()
var cubeVertexIndexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array([
+ new Uint16Array([
0, 1, 2, 0, 2, 3, // front
4, 5, 6, 4, 6, 7, // back
8, 9, 10, 8, 10, 11, // top
@@ -241,7 +241,7 @@ function initBuffers()
generatedColors = generatedColors.concat(c);
}
}
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array(generatedColors), gl.STATIC_DRAW);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(generatedColors), gl.STATIC_DRAW);
gl.vertexAttribPointer(vertexColorAttribute, 4, gl.FLOAT, false, 0, 0);
var cubeVerticesTextureCoordBuffer = gl.createBuffer();
@@ -278,14 +278,14 @@ function initBuffers()
0.0, 1.0,
1.0, 1.0
];
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array(textureCoordinates),
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoordinates),
gl.STATIC_DRAW);
gl.vertexAttribPointer(textureCoordAttribute, 2, gl.FLOAT, false, 0, 0);
var cubeVerticesNormalBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVerticesNormalBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array([
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
// Front
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
diff --git a/examples/canvas3d/texturedcube/qml/texturedcube/texturedcube.js b/examples/canvas3d/texturedcube/qml/texturedcube/texturedcube.js
index 44753b4..acfd185 100644
--- a/examples/canvas3d/texturedcube/qml/texturedcube/texturedcube.js
+++ b/examples/canvas3d/texturedcube/qml/texturedcube/texturedcube.js
@@ -164,7 +164,7 @@ function initBuffers()
gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
gl.bufferData(
gl.ARRAY_BUFFER,
- Arrays.newFloat32Array([// Front face
+ new Float32Array([// Front face
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
@@ -222,7 +222,7 @@ function initBuffers()
generatedColors = generatedColors.concat(c);
}
}
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array(generatedColors), gl.STATIC_DRAW);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(generatedColors), gl.STATIC_DRAW);
gl.enableVertexAttribArray(vertexColorAttribute);
gl.vertexAttribPointer(vertexColorAttribute, 4, gl.FLOAT, false, 0, 0);
@@ -260,7 +260,7 @@ function initBuffers()
0.0, 1.0,
1.0, 1.0
];
- gl.bufferData(gl.ARRAY_BUFFER, Arrays.newFloat32Array(textureCoordinates),
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoordinates),
gl.STATIC_DRAW);
gl.enableVertexAttribArray(textureCoordAttribute);
gl.vertexAttribPointer(textureCoordAttribute, 2, gl.FLOAT, false, 0, 0);
@@ -268,7 +268,7 @@ function initBuffers()
var cubeVertexIndexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,
- Arrays.newUint16Array([
+ new Uint16Array([
0, 1, 2, 0, 2, 3, // front
4, 5, 6, 4, 6, 7, // back
8, 9, 10, 8, 10, 11, // top
diff --git a/src/abstractobject3d.cpp b/src/abstractobject3d.cpp
index 75871bd..bb873bc 100644
--- a/src/abstractobject3d.cpp
+++ b/src/abstractobject3d.cpp
@@ -36,6 +36,7 @@
#include "abstractobject3d_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -87,3 +88,4 @@ bool CanvasAbstractObject::hasSpecificName() const
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/abstractobject3d_p.h b/src/abstractobject3d_p.h
index 27cda48..a2d9fb1 100644
--- a/src/abstractobject3d_p.h
+++ b/src/abstractobject3d_p.h
@@ -51,6 +51,7 @@
#include <QObject>
#include <QThread>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasAbstractObject : public QObject
@@ -75,5 +76,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // ABSTRACTOBJECT3D_P_H
diff --git a/src/activeinfo3d.cpp b/src/activeinfo3d.cpp
index d84cd54..1efba1b 100644
--- a/src/activeinfo3d.cpp
+++ b/src/activeinfo3d.cpp
@@ -36,6 +36,7 @@
#include "activeinfo3d_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -84,3 +85,4 @@ CanvasContext::glEnums CanvasActiveInfo::type() const
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/activeinfo3d_p.h b/src/activeinfo3d_p.h
index 35271d0..b200075 100644
--- a/src/activeinfo3d_p.h
+++ b/src/activeinfo3d_p.h
@@ -50,6 +50,7 @@
#include "context3d_p.h"
#include <QObject>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasActiveInfo : public QObject
@@ -80,5 +81,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // CANVASACTIVEINFO_P_H
diff --git a/src/arrayutils.cpp b/src/arrayutils.cpp
index 49282a8..e8ba44d 100644
--- a/src/arrayutils.cpp
+++ b/src/arrayutils.cpp
@@ -35,3 +35,6 @@
****************************************************************************/
#include "arrayutils_p.h"
+
+QT_BEGIN_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/arrayutils_p.h b/src/arrayutils_p.h
index b041f7a..553ea04 100644
--- a/src/arrayutils_p.h
+++ b/src/arrayutils_p.h
@@ -47,157 +47,16 @@
#ifndef ARRAYUTILS_P_H
#define ARRAYUTILS_P_H
-#include "typedarray/typedarray_p.h"
-#include "typedarray/int8array_p.h"
-#include "typedarray/uint8array_p.h"
-#include "typedarray/int16array_p.h"
-#include "typedarray/uint16array_p.h"
-#include "typedarray/int32array_p.h"
-#include "typedarray/uint32array_p.h"
-#include "typedarray/float32array_p.h"
-#include "typedarray/float64array_p.h"
-#include "typedarray/uint8clampedarray_p.h"
+#include "canvas3dcommon_p.h"
+#include <QtCore/QVariantList>
+
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
-// Contains static template functions used by the TypedArray classes.
class ArrayUtils
{
public:
- template<typename T>
- static bool copyToTarget(T* targetArray, CanvasTypedArray *sourceArray, unsigned long length)
- {
- CanvasInt8Array *int8Source = qobject_cast<CanvasInt8Array*>(sourceArray);
- CanvasUint8Array *uint8Source = qobject_cast<CanvasUint8Array*>(sourceArray);
- CanvasUint8ClampedArray *uint8ClampedSource = qobject_cast<CanvasUint8ClampedArray*>(sourceArray);
- CanvasInt16Array *int16Source = qobject_cast<CanvasInt16Array*>(sourceArray);
- CanvasUint16Array *uint16Source = qobject_cast<CanvasUint16Array*>(sourceArray);
- CanvasInt32Array *int32Source = qobject_cast<CanvasInt32Array*>(sourceArray);
- CanvasUint32Array *uint32Source = qobject_cast<CanvasUint32Array*>(sourceArray);
- CanvasFloat32Array *float32Source = qobject_cast<CanvasFloat32Array*>(sourceArray);
- CanvasFloat64Array *float64Source = qobject_cast<CanvasFloat64Array*>(sourceArray);
- if (int8Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(int8Source->get(idx));
- }
- } else if (uint8Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(uint8Source->get(idx));
- }
- } else if (uint8ClampedSource) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(uint8ClampedSource->get(idx));
- }
- } else if (int16Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(int16Source->get(idx));
- }
- } else if (uint16Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(uint16Source->get(idx));
- }
- } else if (int32Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(int32Source->get(idx));
- }
- } else if (uint32Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(uint32Source->get(idx));
- }
- } else if (float32Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(float32Source->get(idx));
- }
- } else if (float64Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (T)(float64Source->get(idx));
- }
- } else {
- return false;
- }
- return true;
- }
-
- static bool copyToTargetClampedByte(unsigned char *targetArray, CanvasTypedArray *sourceArray,
- unsigned long length)
- {
- CanvasInt8Array *int8Source = qobject_cast<CanvasInt8Array*>(sourceArray);
- CanvasUint8Array *uint8Source = qobject_cast<CanvasUint8Array*>(sourceArray);
- CanvasUint8ClampedArray *uint8ClampedSource = qobject_cast<CanvasUint8ClampedArray*>(sourceArray);
- CanvasInt16Array *int16Source = qobject_cast<CanvasInt16Array*>(sourceArray);
- CanvasUint16Array *uint16Source = qobject_cast<CanvasUint16Array*>(sourceArray);
- CanvasInt32Array *int32Source = qobject_cast<CanvasInt32Array*>(sourceArray);
- CanvasUint32Array *uint32Source = qobject_cast<CanvasUint32Array*>(sourceArray);
- CanvasFloat32Array *float32Source = qobject_cast<CanvasFloat32Array*>(sourceArray);
- CanvasFloat64Array *float64Source = qobject_cast<CanvasFloat64Array*>(sourceArray);
- if (int8Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (unsigned char)(int8Source->get(idx));
- }
- } else if (uint8Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = (unsigned char)(uint8Source->get(idx));
- }
- } else if (uint8ClampedSource) {
- for (unsigned long idx = 0; idx < length; idx++) {
- targetArray[idx] = uint8ClampedSource->get(idx);
- }
- } else if (int16Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- short value = int16Source->get(idx);
- if (value < 0)
- value = 0;
- if (value > 255)
- value = 255;
- targetArray[idx] = (unsigned char) value;
- }
- } else if (uint16Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- unsigned short value = uint16Source->get(idx);
- if (value > 255)
- value = 255;
- targetArray[idx] = (unsigned char) value;
- }
- } else if (int32Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- int value = int32Source->get(idx);
- if (value < 0)
- value = 0;
- if (value > 255)
- value = 255;
- targetArray[idx] = (unsigned char) value;
- }
- } else if (uint32Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- unsigned int value = uint32Source->get(idx);
- if (value > 255)
- value = 255;
- targetArray[idx] = (unsigned char) value;
- }
- } else if (float32Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- float value = float32Source->get(idx);
- if (value < 0)
- value = 0;
- if (value > 255)
- value = 255;
- targetArray[idx] = (unsigned char) value;
- }
- } else if (float64Source) {
- for (unsigned long idx = 0; idx < length; idx++) {
- double value = float64Source->get(idx);
- if (value < 0)
- value = 0;
- if (value > 255)
- value = 255;
- targetArray[idx] = (unsigned char) value;
- }
- } else {
- return false;
- }
- return true;
- }
-
static void fillFloatArrayFromVariantList(const QVariantList &list, float *outArray)
{
int idx = 0;
@@ -232,5 +91,6 @@ public:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // ARRAYUTILS_P_H
diff --git a/src/buffer3d.cpp b/src/buffer3d.cpp
index 671388b..ba4205f 100644
--- a/src/buffer3d.cpp
+++ b/src/buffer3d.cpp
@@ -35,11 +35,11 @@
****************************************************************************/
#include "buffer3d_p.h"
-#include "typedarray/typedarray_p.h"
#include <QDebug>
#include <QString>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -143,3 +143,4 @@ QDebug operator<<(QDebug dbg, const CanvasBuffer *buffer)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/buffer3d_p.h b/src/buffer3d_p.h
index e88782a..10f8c95 100644
--- a/src/buffer3d_p.h
+++ b/src/buffer3d_p.h
@@ -52,6 +52,7 @@
#include <QOpenGLFunctions>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasBuffer : public CanvasAbstractObject, protected QOpenGLFunctions
@@ -83,5 +84,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // BUFFER3D_P_H
diff --git a/src/canvas3d.cpp b/src/canvas3d.cpp
index 5bcb95f..8958cc8 100644
--- a/src/canvas3d.cpp
+++ b/src/canvas3d.cpp
@@ -40,10 +40,6 @@
#include "canvasrendernode_p.h"
#include "teximage3d_p.h"
-#include "typedarray/typedarray_p.h"
-#include "typedarray/uint32array_p.h"
-#include "typedarray/arraybuffer_p.h"
-
#include <QtGui/QGuiApplication>
#include <QtGui/QOffscreenSurface>
#include <QtGui/QOpenGLContext>
@@ -52,6 +48,7 @@
#include <QtQml/QQmlContext>
#include <QtCore/QElapsedTimer>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -738,3 +735,4 @@ void Canvas::renderNext()
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/canvas3d_p.h b/src/canvas3d_p.h
index a525973..c20a3b7 100644
--- a/src/canvas3d_p.h
+++ b/src/canvas3d_p.h
@@ -55,6 +55,7 @@
class QOffscreenSurface;
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class QT_CANVAS3D_EXPORT Canvas : public QQuickItem, QOpenGLFunctions
@@ -148,6 +149,7 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // CANVAS3D_P_H
diff --git a/src/canvasglstatedump.cpp b/src/canvasglstatedump.cpp
index dd23557..2d207ee 100644
--- a/src/canvasglstatedump.cpp
+++ b/src/canvasglstatedump.cpp
@@ -42,6 +42,7 @@
#define BOOL_TO_STR(a) a ? "true" : "false"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -425,3 +426,4 @@ QString CanvasGLStateDump::getGLStateDump(CanvasGLStateDump::stateDumpEnums opti
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/canvasglstatedump_p.h b/src/canvasglstatedump_p.h
index 503d546..fd43a99 100644
--- a/src/canvasglstatedump_p.h
+++ b/src/canvasglstatedump_p.h
@@ -52,6 +52,7 @@
#include <QObject>
#include <QtGui/QOpenGLFunctions>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
#define DUMP_ENUM_AS_PROPERTY(A,B,C) Q_PROPERTY(A::B C READ C ## _read); inline A::B C ## _read() { return A::C; }
@@ -91,5 +92,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // CANVASGLSTATEDUMP_P_H
diff --git a/src/canvasrendernode.cpp b/src/canvasrendernode.cpp
index dbe3f81..4b10224 100644
--- a/src/canvasrendernode.cpp
+++ b/src/canvasrendernode.cpp
@@ -39,6 +39,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFramebufferObject>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
CanvasRenderNode::CanvasRenderNode(Canvas *canvas, QQuickWindow *window) :
@@ -103,3 +104,4 @@ void CanvasRenderNode::prepareNode()
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/canvasrendernode_p.h b/src/canvasrendernode_p.h
index 7448107..21ad898 100644
--- a/src/canvasrendernode_p.h
+++ b/src/canvasrendernode_p.h
@@ -52,6 +52,7 @@
#include <QtQuick/QQuickWindow>
#include <QtCore/QMutex>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class Canvas;
@@ -82,5 +83,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // CANVASRENDERNODE_P_H
diff --git a/src/context3d.cpp b/src/context3d.cpp
index 9e433e1..ceb0a36 100644
--- a/src/context3d.cpp
+++ b/src/context3d.cpp
@@ -24,8 +24,8 @@
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
@@ -52,19 +52,13 @@
#include "canvas3dcommon_p.h"
#include "contextextensions_p.h"
-#include "typedarray/arraybuffer_p.h"
-#include "typedarray/int8array_p.h"
-#include "typedarray/uint8array_p.h"
-#include "typedarray/int16array_p.h"
-#include "typedarray/uint16array_p.h"
-#include "typedarray/int32array_p.h"
-#include "typedarray/uint32array_p.h"
-#include "typedarray/float32array_p.h"
-#include "typedarray/float64array_p.h"
-
#include <QtGui/QOpenGLShader>
-#include <QtQml>
+#include <QtQml/private/qv4typedarray_p.h>
+#include <QtQml/private/qv4arraybuffer_p.h>
+#include <QtQml/private/qjsvalue_p.h>
+#include <QtCore/private/qbytedata_p.h>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -85,6 +79,7 @@ CanvasContext::CanvasContext(QOpenGLContext *context, QSurface *surface, QQmlEng
CanvasAbstractObject(parent),
QOpenGLFunctions(context),
m_engine(engine),
+ m_v4engine(QQmlEnginePrivate::getV4Engine(engine)),
m_unpackFlipYEnabled(false),
m_unpackPremultiplyAlphaEnabled(false),
m_logAllCalls(false),
@@ -94,7 +89,7 @@ CanvasContext::CanvasContext(QOpenGLContext *context, QSurface *surface, QQmlEng
m_currentProgram(0),
m_currentArrayBuffer(0),
m_currentElementArrayBuffer(0),
- m_currentTexture(0),
+ m_currentTexture2D(0),
m_context(context),
m_surface(surface),
m_error(NO_ERROR),
@@ -500,14 +495,23 @@ void CanvasContext::bindTexture(glEnums target, QJSValue texture3D)
<< ")";
CanvasTexture *texture = getAsTexture3D(texture3D);
- m_currentTexture = texture;
+ if (target == TEXTURE_2D)
+ m_currentTexture2D = texture;
+ else if (target == TEXTURE_CUBE_MAP)
+ m_currentTextureCubeMap = texture;
+
if (texture) {
if (!texture->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ": Trying to bind deleted texture object";
return;
}
- m_currentTexture->bind(target);
+
+ if (target == TEXTURE_2D)
+ m_currentTexture2D->bind(target);
+ else if (target == TEXTURE_CUBE_MAP)
+ m_currentTextureCubeMap->bind(target);
+
} else {
glBindTexture(GLenum(target), 0);
}
@@ -528,17 +532,33 @@ void CanvasContext::generateMipmap(glEnums target)
if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__
<< "(target:" << glEnumToString(target)
<< ")";
- if (!m_currentTexture) {
- if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_OPERATION No current texture bound";
- m_error = INVALID_OPERATION;
- } else if (!m_currentTexture->isAlive()) {
- if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_OPERATION Currently bound texture is deleted";
- m_error = INVALID_OPERATION;
- } else {
- glGenerateMipmap(target);
- logAllGLErrors(__FUNCTION__);
+
+ if (target == TEXTURE_2D) {
+ if (!m_currentTexture2D) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION No current TEXTURE_2D bound";
+ m_error = INVALID_OPERATION;
+ } else if (!m_currentTexture2D->isAlive()) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION Currently bound TEXTURE_2D is deleted";
+ m_error = INVALID_OPERATION;
+ } else {
+ glGenerateMipmap(target);
+ logAllGLErrors(__FUNCTION__);
+ }
+ } else if (target == TEXTURE_CUBE_MAP) {
+ if (!m_currentTextureCubeMap) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION No current TEXTURE_CUBE_MAP bound";
+ m_error = INVALID_OPERATION;
+ } else if (!m_currentTextureCubeMap->isAlive()) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION Currently bound TEXTURE_CUBE_MAP is deleted";
+ m_error = INVALID_OPERATION;
+ } else {
+ glGenerateMipmap(target);
+ logAllGLErrors(__FUNCTION__);
+ }
}
}
@@ -604,18 +624,49 @@ void CanvasContext::compressedTexImage2D(glEnums target, int level, glEnums inte
<< ", pixels:" << pixels.toString()
<< ")";
- if (!m_currentTexture) {
- if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_OPERATION No current texture bound";
- m_error = INVALID_OPERATION;
- } else if (!m_currentTexture->isAlive()) {
- if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_OPERATION Currently bound texture is deleted";
- m_error = INVALID_OPERATION;
+ if (target == TEXTURE_2D) {
+ if (!m_currentTexture2D) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION No current TEXTURE_2D bound";
+ m_error = INVALID_OPERATION;
+ return;
+ } else if (!m_currentTexture2D->isAlive()) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION Currently bound TEXTURE_2D is deleted";
+ m_error = INVALID_OPERATION;
+ return;
+ }
+ } else if (target == TEXTURE_CUBE_MAP) {
+ if (!m_currentTextureCubeMap) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION No current TEXTURE_CUBE_MAP bound";
+ m_error = INVALID_OPERATION;
+ return;
+ } else if (!m_currentTextureCubeMap->isAlive()) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION Currently bound TEXTURE_CUBE_MAP is deleted";
+ m_error = INVALID_OPERATION;
+ return;
+ }
+ }
+
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, pixels));
+
+ if (typedArray) {
+ glCompressedTexImage2D(target,
+ level,
+ internalformat,
+ width, height, border,
+ typedArray->byteLength(),
+ (GLvoid *) typedArray->arrayData()->data());
+ logAllGLErrors(__FUNCTION__);
} else {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_ENUM Canvas3D doesn't support compressed images";
- m_error = INVALID_ENUM;
+ << ":INVALID_VALUE pixels must be TypedArray";
+ m_error = INVALID_VALUE;
+ return;
}
}
@@ -645,18 +696,50 @@ void CanvasContext::compressedTexSubImage2D(glEnums target, int level,
<< ", pixels:" << pixels.toString()
<< ")";
- if (!m_currentTexture) {
- if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_OPERATION No current texture bound";
- m_error = INVALID_OPERATION;
- } else if (!m_currentTexture->isAlive()) {
- if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_OPERATION Currently bound texture is deleted";
- m_error = INVALID_OPERATION;
+ if (target == TEXTURE_2D) {
+ if (!m_currentTexture2D) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION No current TEXTURE_2D bound";
+ m_error = INVALID_OPERATION;
+ return;
+ } else if (!m_currentTexture2D->isAlive()) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION Currently bound TEXTURE_2D is deleted";
+ m_error = INVALID_OPERATION;
+ return;
+ }
+ } else if (target == TEXTURE_CUBE_MAP) {
+ if (!m_currentTextureCubeMap) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION No current TEXTURE_CUBE_MAP bound";
+ m_error = INVALID_OPERATION;
+ return;
+ } else if (!m_currentTextureCubeMap->isAlive()) {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_OPERATION Currently bound TEXTURE_CUBE_MAP is deleted";
+ m_error = INVALID_OPERATION;
+ return;
+ }
+ }
+
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, pixels));
+
+ if (typedArray) {
+ glCompressedTexSubImage2D(target,
+ level,
+ xoffset, yoffset,
+ width, height,
+ format,
+ typedArray->byteLength(),
+ (GLvoid *) typedArray->arrayData()->data());
+ logAllGLErrors(__FUNCTION__);
} else {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << ":INVALID_ENUM API doesn't support compressed images";
- m_error = INVALID_ENUM;
+ << ":INVALID_VALUE pixels must be TypedArray";
+ m_error = INVALID_VALUE;
+ return;
}
}
@@ -701,11 +784,11 @@ void CanvasContext::copyTexImage2D(glEnums target, int level, glEnums internalfo
<< ", border:" << border
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -753,11 +836,11 @@ void CanvasContext::copyTexSubImage2D(glEnums target, int level,
<< ", height:" << height
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -813,13 +896,13 @@ void CanvasContext::texImage2D(glEnums target, int level, glEnums internalformat
<< ", type:" << glEnumToString(type)
<< ", pixels:" << pixels.toString()
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::"
<< __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
return;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -925,23 +1008,37 @@ void CanvasContext::texImage2D(glEnums target, int level, glEnums internalformat
/*!
* \internal
*/
-uchar *CanvasContext::getAsUint8ArrayRawPtr(QJSValue value)
+uchar *CanvasContext::getAsUint8ArrayRawPtr(QJSValue jsValue)
{
- if (!isOfType(value, "QtCanvas3D::CanvasUint8Array"))
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, jsValue));
+
+ if (!typedArray)
return 0;
- return static_cast<CanvasUint8Array *>(value.toQObject())->rawDataCptr();
+ if (typedArray->arrayType() != QV4::Heap::TypedArray::UInt8Array)
+ return 0;
+
+ return reinterpret_cast<unsigned char *>(typedArray->arrayData()->data());
}
/*!
* \internal
*/
-uchar *CanvasContext::getAsUint16ArrayRawPtr(QJSValue value)
+uchar *CanvasContext::getAsUint16ArrayRawPtr(QJSValue jsValue)
{
- if (!isOfType(value, "QtCanvas3D::CanvasUint16Array"))
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, jsValue));
+
+ if (!typedArray)
return 0;
- return static_cast<CanvasUint16Array *>(value.toQObject())->rawDataCptr();
+ if (typedArray->arrayType() != QV4::Heap::TypedArray::UInt16Array)
+ return 0;
+
+ return reinterpret_cast<unsigned char *>(typedArray->arrayData()->data());
}
/*!
@@ -985,12 +1082,12 @@ void CanvasContext::texSubImage2D(glEnums target, int level,
<< ", type:" << glEnumToString(type)
<< ", pixels:" << pixels.toString()
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
return;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -1162,12 +1259,12 @@ void CanvasContext::texImage2D(glEnums target, int level, glEnums internalformat
<< ", texImage:" << texImage.toString()
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
return;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -1206,8 +1303,8 @@ void CanvasContext::texImage2D(glEnums target, int level, glEnums internalformat
return;
}
- if (!m_currentTexture->hasSpecificName()) {
- m_currentTexture->setName("ImageTexture_"+image->name());
+ if (!m_currentTexture2D->hasSpecificName()) {
+ m_currentTexture2D->setName("ImageTexture_"+image->name());
}
glTexImage2D(target, level, internalformat, image->width(), image->height(), 0, format, type,
@@ -1267,12 +1364,12 @@ void CanvasContext::texSubImage2D(glEnums target, int level,
<< ", texImage:" << texImage.toString()
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
return;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -1337,12 +1434,12 @@ void CanvasContext::texParameterf(glEnums target, glEnums pname, float param)
<< ", param:" << param
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
return;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -1373,12 +1470,12 @@ void CanvasContext::texParameteri(glEnums target, glEnums pname, int param)
<< ", pname:" << glEnumToString(pname)
<< ", param:" << glEnumToString(glEnums(param))
<< ")";
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
return;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -1609,13 +1706,6 @@ void CanvasContext::framebufferTexture2D(glEnums target, glEnums attachment, glE
CanvasTexture *texture = getAsTexture3D(texture3D);
if (texture) {
- // TODO: If texture is not zero, then texture must either name an existing texture
- //object with an target of textarget, or texture must name an existing cube map
- //texture and textarget must be one of:
- //TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_- POSITIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_- Z,
- //TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_Y, or TEXTURE_CUBE_MAP_NEGATIVE_Z.
- //Otherwise, INVALID_OPERATION is generated.
-
if (textarget != TEXTURE_2D
&& textarget != TEXTURE_CUBE_MAP_POSITIVE_X
&& textarget != TEXTURE_CUBE_MAP_POSITIVE_Y
@@ -1624,7 +1714,7 @@ void CanvasContext::framebufferTexture2D(glEnums target, glEnums attachment, glE
&& textarget != TEXTURE_CUBE_MAP_NEGATIVE_Y
&& textarget != TEXTURE_CUBE_MAP_NEGATIVE_Z) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
- << "(): textarget attachment must be one of TEXTURE_2D, "
+ << "(): textarget must be one of TEXTURE_2D, "
<< "TEXTURE_CUBE_MAP_POSITIVE_X, "
<< "TEXTURE_CUBE_MAP_POSITIVE_Y, "
<< "TEXTURE_CUBE_MAP_POSITIVE_Z, "
@@ -2469,7 +2559,6 @@ QVariant CanvasContext::getProgramParameter(QJSValue program3D, glEnums paramNam
return QVariant::fromValue(value);
}
default: {
- // TODO: Implement rest of the parameters
m_error = INVALID_ENUM;
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ": INVALID_ENUM illegal parameter name ";
@@ -2491,13 +2580,9 @@ QJSValue CanvasContext::createShader(glEnums type)
switch (type) {
case VERTEX_SHADER:
if (m_logAllCalls) qDebug() << "Context3D::createShader(VERTEX_SHADER)";
- // Returning a pointer to QObject that has parent set
- // -> V4VM should respect this and ownership should remain with this class
return m_engine->newQObject(new CanvasShader(QOpenGLShader::Vertex, this));
case FRAGMENT_SHADER:
if (m_logAllCalls) qDebug() << "Context3D::createShader(FRAGMENT_SHADER)";
- // Returning a pointer to QObject that has parent set
- // -> V4VM should respect this and ownership should remain with this class
return m_engine->newQObject(new CanvasShader(QOpenGLShader::Fragment, this));
default:
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
@@ -2716,14 +2801,18 @@ void CanvasContext::uniform1iv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasInt32Array")))
- return;
- CanvasInt32Array *arrayObj = static_cast<CanvasInt32Array *>(array.toQObject());
- if (!locationObj || !arrayObj)
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Int32Array)
return;
- glUniform1iv(locationObj->id(), arrayObj->length(), (int *)arrayObj->rawDataCptr());
+ glUniform1iv(locationObj->id(),
+ typedArray->length(),
+ (int *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -2774,14 +2863,17 @@ void CanvasContext::uniform1fv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- CanvasFloat32Array *arrayObj = static_cast<CanvasFloat32Array *>(array.toQObject());
- if (!locationObj || !arrayObj)
- return;
-
- glUniform1fv(locationObj->id(), arrayObj->length(), (float *)arrayObj->rawDataCptr());
+ glUniform1fv(locationObj->id(),
+ typedArray->length(),
+ (float *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -2833,14 +2925,17 @@ void CanvasContext::uniform2fv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
- return;
- CanvasFloat32Array *arrayObj = static_cast<CanvasFloat32Array *>(array.toQObject());
-
- if (!locationObj || !arrayObj)
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- glUniform2fv(locationObj->id(), arrayObj->length() / 2, (float *)arrayObj->rawDataCptr());
+ glUniform2fv(locationObj->id(),
+ typedArray->length() / 2,
+ (float *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -2892,14 +2987,18 @@ void CanvasContext::uniform2iv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasInt32Array")))
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Int32Array)
return;
- CanvasInt32Array *arrayObj = static_cast<CanvasInt32Array *>(array.toQObject());
- if (!locationObj || !arrayObj)
- return;
+ glUniform2iv(locationObj->id(),
+ typedArray->length() / 2,
+ (int *)typedArray->arrayData()->data());
- glUniform2iv(locationObj->id(), arrayObj->length() / 2, (int *)arrayObj->rawDataCptr());
logAllGLErrors(__FUNCTION__);
}
@@ -2951,14 +3050,15 @@ void CanvasContext::uniform3fv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
- return;
- CanvasFloat32Array *arrayObj = static_cast<CanvasFloat32Array *>(array.toQObject());
-
- if (!locationObj || !arrayObj)
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray || !locationObj || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- glUniform3fv(locationObj->id(), arrayObj->length() / 3, (float *)arrayObj->rawDataCptr());
+ glUniform3fv(locationObj->id(),
+ typedArray->length() / 3,
+ (float *) typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3009,14 +3109,15 @@ void CanvasContext::uniform3iv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasInt32Array")))
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray || !locationObj || typedArray->arrayType() != QV4::Heap::TypedArray::Int32Array)
return;
- CanvasInt32Array *arrayObj = static_cast<CanvasInt32Array *>(array.toQObject());
- if (!locationObj || !arrayObj)
- return;
-
- glUniform3iv(locationObj->id(), arrayObj->length() / 3, (int *)arrayObj->rawDataCptr());
+ glUniform3iv(locationObj->id(),
+ typedArray->length() / 3,
+ (int *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3068,14 +3169,17 @@ void CanvasContext::uniform4fv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
- return;
- CanvasFloat32Array *arrayObj = static_cast<CanvasFloat32Array *>(array.toQObject());
-
- if (!locationObj || !arrayObj)
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- glUniform4fv(locationObj->id(), arrayObj->length() / 4, (float *)arrayObj->rawDataCptr());
+ glUniform4fv(locationObj->id(),
+ typedArray->length() / 4,
+ (float *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3127,14 +3231,17 @@ void CanvasContext::uniform4iv(QJSValue location3D, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasInt32Array")))
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Int32Array)
return;
- CanvasInt32Array *arrayObj = static_cast<CanvasInt32Array *>(array.toQObject());
- if (!locationObj || !arrayObj)
- return;
-
- glUniform4iv(locationObj->id(), arrayObj->length() / 4, (int *)arrayObj->rawDataCptr());
+ glUniform4iv(locationObj->id(),
+ typedArray->length() / 4,
+ (int *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3319,11 +3426,14 @@ void CanvasContext::vertexAttrib1fv(unsigned int indx, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
+ // Check if we have a Float32Array
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- CanvasFloat32Array *values = static_cast<CanvasFloat32Array *>(array.toQObject());
- glVertexAttrib1fv(indx, (float *)values->rawDataCptr());
+ glVertexAttrib1fv(indx, (float *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3367,12 +3477,14 @@ void CanvasContext::vertexAttrib2fv(unsigned int indx, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
+ // Check if we have a Float32Array
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- CanvasFloat32Array *values = static_cast<CanvasFloat32Array *>(array.toQObject());
-
- glVertexAttrib2fv(indx, (float *)values->rawDataCptr());
+ glVertexAttrib2fv(indx, (float *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3417,12 +3529,14 @@ void CanvasContext::vertexAttrib3fv(unsigned int indx, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
+ // Check if we have a Float32Array
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- CanvasFloat32Array *values = static_cast<CanvasFloat32Array *>(array.toQObject());
-
- glVertexAttrib3fv(indx, (float *)values->rawDataCptr());
+ glVertexAttrib3fv(indx, (float *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3468,12 +3582,14 @@ void CanvasContext::vertexAttrib4fv(unsigned int indx, QJSValue array)
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
+ // Check if we have a Float32Array
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!typedArray || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- CanvasFloat32Array *values = static_cast<CanvasFloat32Array *>(array.toQObject());
-
- glVertexAttrib4fv(indx, (float *)values->rawDataCptr());
+ glVertexAttrib4fv(indx, (float *)typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
}
@@ -3499,7 +3615,6 @@ int CanvasContext::getShaderParameter(QJSValue shader3D, glEnums pname)
return 0;
}
-
switch (pname) {
case SHADER_TYPE: {
GLint shaderType = 0;
@@ -3698,18 +3813,21 @@ void CanvasContext::uniformMatrix2fv(QJSValue location3D, bool transpose, QJSVal
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
+ // We should have a Float32Array
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!m_currentProgram
+ || !typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- CanvasFloat32Array *arrayObj = static_cast<CanvasFloat32Array *>(array.toQObject());
- if (!m_currentProgram || !locationObj || !arrayObj)
- return;
- if (m_logAllCalls) qDebug() << " numMatrices:" << (arrayObj->length() / 4);
+ if (m_logAllCalls) qDebug() << " numMatrices:" << (typedArray->length() / 4);
int uniformLocation = locationObj->id();
- float *arrayData = (float *)arrayObj->rawDataCptr();
- int numMatrices = arrayObj->length() / 4;
-
+ float *arrayData = (float *)typedArray->arrayData()->data();
+ int numMatrices = typedArray->length() / 4;
glUniformMatrix2fv(uniformLocation, numMatrices, transpose, arrayData);
logAllGLErrors(__FUNCTION__);
}
@@ -3741,17 +3859,21 @@ void CanvasContext::uniformMatrix3fv(QJSValue location3D, bool transpose, QJSVal
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
+ // We should have a Float32Array
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!m_currentProgram
+ || !typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- CanvasFloat32Array *arrayObj = static_cast<CanvasFloat32Array *>(array.toQObject());
- if (!m_currentProgram || !locationObj || !arrayObj)
- return;
- if (m_logAllCalls) qDebug() << " numMatrices:" << (arrayObj->length() / 9);
+ if (m_logAllCalls) qDebug() << " numMatrices:" << (typedArray->length() / 9);
int uniformLocation = locationObj->id();
- float *arrayData = (float *) arrayObj->rawDataCptr();
- int numMatrices = arrayObj->length() / 9;
+ float *arrayData = (float *)typedArray->arrayData()->data();
+ int numMatrices = typedArray->length() / 9;
glUniformMatrix3fv(uniformLocation, numMatrices, transpose, arrayData);
logAllGLErrors(__FUNCTION__);
@@ -3778,23 +3900,27 @@ void CanvasContext::uniformMatrix4fv(QJSValue location3D, bool transpose, QJSVal
CanvasUniformLocation *locationObj =
static_cast<CanvasUniformLocation *>(location3D.toQObject());
+
// Check if we have a JavaScript array
if (array.isArray()) {
uniformMatrix4fva(locationObj, transpose,array.toVariant().toList());
return;
}
- if (!isOfType(array, QStringLiteral("QtCanvas3D::CanvasFloat32Array")))
- return;
- CanvasFloat32Array *arrayObj = static_cast<CanvasFloat32Array *>(array.toQObject());
-
- if (!m_currentProgram || !locationObj || !arrayObj)
+ // We should have a Float32Array
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, array));
+ if (!m_currentProgram
+ || !typedArray
+ || !locationObj
+ || typedArray->arrayType() != QV4::Heap::TypedArray::Float32Array)
return;
- if (m_logAllCalls) qDebug() << " numMatrices:" << (arrayObj->length() / 16);
+ if (m_logAllCalls) qDebug() << " numMatrices:" << (typedArray->length() / 16);
int uniformLocation = locationObj->id();
- float *arrayData = (float *)arrayObj->rawDataCptr();
- int numMatrices = arrayObj->length() / 16;
+ float *arrayData = (float *)typedArray->arrayData()->data();
+ int numMatrices = typedArray->length() / 16;
glUniformMatrix4fv(uniformLocation, numMatrices, transpose, arrayData);
logAllGLErrors(__FUNCTION__);
@@ -3913,7 +4039,7 @@ void CanvasContext::vertexAttribPointer(int indx, int size, glEnums type,
/*!
* \qmlmethod void Context3D::bufferData(glEnums target, long size, glEnums usage)
* Sets the size of the \a target buffer to \a size. Target buffer must be either
- * \c Context3D.ARRAY_BUFFER or \c{Context3D.ELEMENT_ARRAY_BUFFER}. \a usage sets the usage pattern
+ * \c{Context3D.ARRAY_BUFFER} or \c{Context3D.ELEMENT_ARRAY_BUFFER}. \a usage sets the usage pattern
* of the data, and must be one of \c{Context3D.STREAM_DRAW}, \c{Context3D.STATIC_DRAW}, or
* \c{Context3D.DYNAMIC_DRAW}.
*/
@@ -3922,14 +4048,12 @@ void CanvasContext::vertexAttribPointer(int indx, int size, glEnums type,
*/
void CanvasContext::bufferData(glEnums target, long size, glEnums usage)
{
- // TODO: Sort this out, it doesn't follow any reason or rhyme...
if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__
<< "(target:" << glEnumToString(target)
<< ", size:" << size
<< ", usage:" << glEnumToString(usage)
<< ")";
- CanvasTypedArray *tempArray;
switch (target) {
case ARRAY_BUFFER:
if (!m_currentArrayBuffer) {
@@ -3938,8 +4062,6 @@ void CanvasContext::bufferData(glEnums target, long size, glEnums usage)
m_error = INVALID_OPERATION;
return;
}
-
- tempArray = createTypedArray(FLOAT, size);
break;
case ELEMENT_ARRAY_BUFFER:
if (!m_currentElementArrayBuffer) {
@@ -3949,7 +4071,6 @@ void CanvasContext::bufferData(glEnums target, long size, glEnums usage)
m_error = INVALID_OPERATION;
return;
}
- tempArray = createTypedArray(UNSIGNED_SHORT, size);
break;
default:
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
@@ -3958,40 +4079,14 @@ void CanvasContext::bufferData(glEnums target, long size, glEnums usage)
return;
}
- glBufferData(GLenum(target), size, (GLvoid *)tempArray->rawDataCptr(), GLenum(usage));
+ glBufferData(GLenum(target), size, (GLvoid *) 0, GLenum(usage));
logAllGLErrors(__FUNCTION__);
- delete tempArray;
-}
-
-/*!
- * \internal
- */
-CanvasTypedArray *CanvasContext::createTypedArray(glEnums dataType, long size)
-{
- switch (dataType) {
- case BYTE:
- return new CanvasInt8Array(size, this);
- case UNSIGNED_BYTE:
- return new CanvasUint8Array(size, this);
- case SHORT:
- return new CanvasInt16Array(size, this);
- case UNSIGNED_SHORT:
- return new CanvasUint16Array(size, this);
- case INT:
- return new CanvasInt32Array(size, this);
- case UNSIGNED_INT:
- return new CanvasUint32Array(size, this);
- case FLOAT:
- return new CanvasFloat32Array(size, this);
- default:
- return 0;
- }
}
/*!
* \qmlmethod void Context3D::bufferData(glEnums target, value data, glEnums usage)
* Writes the \a data held in \c{ArrayBufferView} or \c{ArrayBuffer} to the \a target buffer.
- * Target buffer must be either \c Context3D.ARRAY_BUFFER or \c{Context3D.ELEMENT_ARRAY_BUFFER}.
+ * Target buffer must be either \c{Context3D.ARRAY_BUFFER } or \c{Context3D.ELEMENT_ARRAY_BUFFER}.
* \a usage sets the usage pattern of the data, and must be one of \c{Context3D.STREAM_DRAW},
* \c{Context3D.STATIC_DRAW}, or \c{Context3D.DYNAMIC_DRAW}.
*/
@@ -4021,21 +4116,31 @@ void CanvasContext::bufferData(glEnums target, QJSValue data, glEnums usage)
return;
}
- if (isOfType(data, "QtCanvas3D::CanvasArrayBufferView")) {
- CanvasArrayBufferView *bufferView = static_cast<CanvasArrayBufferView *>(data.toQObject());
+
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, data));
+ QV4::Scoped<QV4::ArrayBuffer> arrayBuffer(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, data));
+
+ if (typedArray) {
glBufferData(GLenum(target),
- bufferView->byteLength(),
- (GLvoid *)bufferView->rawDataCptr(),
+ typedArray->byteLength(),
+ (GLvoid *) typedArray->arrayData()->data(),
GLenum(usage));
logAllGLErrors(__FUNCTION__);
-
- } else if (isOfType(data, "QtCanvas3D::CanvasArrayBuffer")) {
- CanvasArrayBuffer *buffer = static_cast<CanvasArrayBuffer *>(data.toQObject());
+ } else if (arrayBuffer) {
glBufferData(GLenum(target),
- buffer->byteLength(),
- (GLvoid*)buffer->rawData(),
+ arrayBuffer->byteLength(),
+ (GLvoid *) arrayBuffer->data(),
GLenum(usage));
logAllGLErrors(__FUNCTION__);
+ } else {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_VALUE data must be either"
+ << "TypedArray or ArrayBuffer";
+ m_error = INVALID_VALUE;
+ return;
}
}
@@ -4071,21 +4176,30 @@ void CanvasContext::bufferSubData(glEnums target, int offset, QJSValue data)
return;
}
- if (isOfType(data, "QtCanvas3D::CanvasArrayBufferView")) {
- CanvasArrayBufferView *bufferView = static_cast<CanvasArrayBufferView *>(data.toQObject());
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::TypedArray> typedArray(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, data));
+ QV4::Scoped<QV4::ArrayBuffer> arrayBuffer(scope,
+ QJSValuePrivate::convertedToValue(m_v4engine, data));
+
+ if (typedArray) {
glBufferSubData(GLenum(target),
offset,
- bufferView->byteLength(),
- (GLvoid *)bufferView->rawDataCptr());
+ typedArray->byteLength(),
+ (GLvoid *) typedArray->arrayData()->data());
logAllGLErrors(__FUNCTION__);
-
- } else if (isOfType(data, "QtCanvas3D::CanvasArrayBuffer")) {
- CanvasArrayBuffer *buffer = static_cast<CanvasArrayBuffer *>(data.toQObject());
+ } else if (arrayBuffer) {
glBufferSubData(GLenum(target),
offset,
- buffer->byteLength(),
- (GLvoid*)buffer->rawData());
+ arrayBuffer->byteLength(),
+ (GLvoid *) arrayBuffer->data());
logAllGLErrors(__FUNCTION__);
+ } else {
+ if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
+ << ":INVALID_VALUE data must be either"
+ << "TypedArray or ArrayBuffer";
+ m_error = INVALID_VALUE;
+ return;
}
}
@@ -4221,95 +4335,284 @@ CanvasContext::glEnums CanvasContext::getError()
/*!
* \internal
*/
-QVariant CanvasContext::getParameter(glEnums pname)
+QJSValue CanvasContext::getParameter(glEnums pname)
{
if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__
<< "( pname:" << glEnumToString(pname)
<< ")";
- GLint value;
+
+ // TODO: Implement these:
+ // CURRENT_PROGRAM m_currentProgram
+ // ELEMENT_ARRAY_BUFFER_BINDING m_currentElementArrayBuffer
+ // FRAMEBUFFER_BINDING WebGLFramebuffer
+ // RENDERBUFFER_BINDING WebGLRenderbuffer
+ // ARRAY_BUFFER_BINDING m_currentArrayBuffer
+ // TEXTURE_BINDING_2D m_currentTexture2D
+ // TEXTURE_BINDING_CUBE_MAP m_currentTextureCubeMap
switch (pname) {
- // INTEGER PARAMETERS
+ // GLint values
+ // Intentional flow through
+ case MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+ case MAX_FRAGMENT_UNIFORM_VECTORS:
+ case MAX_RENDERBUFFER_SIZE:
+ case MAX_VARYING_VECTORS:
+ case MAX_VERTEX_ATTRIBS:
+ case MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+#if defined(QT_OPENGL_ES_2)
+ case MAX_VERTEX_UNIFORM_VECTORS:
+#endif
+ case PACK_ALIGNMENT:
+ case SAMPLE_BUFFERS:
+ case SAMPLES:
+ case STENCIL_BACK_REF:
+ case STENCIL_CLEAR_VALUE:
+ case STENCIL_REF:
+ case SUBPIXEL_BITS:
+ case UNPACK_ALIGNMENT:
case RED_BITS:
- // Intentional flow through
case GREEN_BITS:
- // Intentional flow through
case BLUE_BITS:
- // Intentional flow through
case ALPHA_BITS:
- // Intentional flow through
case DEPTH_BITS:
- // Intentional flow through
case STENCIL_BITS:
- // Intentional flow through
case MAX_TEXTURE_IMAGE_UNITS:
- // Intentional flow through
- case MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- // Intentional flow through
case MAX_TEXTURE_SIZE:
- // Intentional flow through
case MAX_CUBE_MAP_TEXTURE_SIZE:
{
+ GLint value;
glGetIntegerv(pname, &value);
logAllGLErrors(__FUNCTION__);
- return QVariant::fromValue(value);
+ return QJSValue(int(value));
}
+
+ // GLuint values
+ // Intentional flow through
+ case STENCIL_BACK_VALUE_MASK:
+ case STENCIL_BACK_WRITEMASK:
+ case STENCIL_VALUE_MASK:
+ case STENCIL_WRITEMASK:
+ {
+ GLint value;
+ glGetIntegerv(pname, &value);
+ logAllGLErrors(__FUNCTION__);
+ return QJSValue(uint(value));
+ }
+
case FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
if (m_standardDerivatives) {
+ GLint value;
glGetIntegerv(pname, &value);
logAllGLErrors(__FUNCTION__);
- return QVariant::fromValue(value);
- } else {
- m_error = INVALID_ENUM;
- return QVariant::fromValue(0);
+ return QJSValue(value);
}
- break;
+ m_error = INVALID_ENUM;
+ return QJSValue(QJSValue::NullValue);
+
#if !defined(QT_OPENGL_ES_2)
case MAX_VERTEX_UNIFORM_VECTORS: {
+ GLint value;
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &value);
logAllGLErrors(__FUNCTION__);
if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ << "():" << value;
- return QVariant::fromValue(value);
+ return QJSValue(value);
}
#endif
- // STRING PARAMETERS
- case RENDERER:
+
+ // GLboolean values
// Intentional flow through
- case SHADING_LANGUAGE_VERSION:
+ case BLEND:
+ case CULL_FACE:
+ case DEPTH_TEST:
+ case DEPTH_WRITEMASK:
+ case DITHER:
+ case POLYGON_OFFSET_FILL:
+ case SAMPLE_COVERAGE_INVERT:
+ case SCISSOR_TEST:
+ case STENCIL_TEST: {
+ GLboolean value;
+ glGetBooleanv(pname, &value);
+ logAllGLErrors(__FUNCTION__);
+ return QJSValue(bool(value));
+ }
+ case UNPACK_FLIP_Y_WEBGL:
+ return QJSValue(m_unpackFlipYEnabled);
+ case UNPACK_PREMULTIPLY_ALPHA_WEBGL:
+ return QJSValue(m_unpackPremultiplyAlphaEnabled);
+
+ // GLenum values
// Intentional flow through
- case VENDOR:
+ case ACTIVE_TEXTURE:
+ case BLEND_DST_ALPHA:
+ case BLEND_DST_RGB:
+ case BLEND_EQUATION_ALPHA:
+ case BLEND_EQUATION_RGB:
+ case BLEND_SRC_ALPHA:
+ case BLEND_SRC_RGB:
+ case CULL_FACE_MODE:
+ case DEPTH_FUNC:
+ case FRONT_FACE:
+ case GENERATE_MIPMAP_HINT:
+ case STENCIL_BACK_FAIL:
+ case STENCIL_BACK_FUNC:
+ case STENCIL_BACK_PASS_DEPTH_FAIL:
+ case STENCIL_BACK_PASS_DEPTH_PASS:
+ case STENCIL_FAIL:
+ case STENCIL_FUNC:
+ case STENCIL_PASS_DEPTH_FAIL:
+ case STENCIL_PASS_DEPTH_PASS: {
+ GLint value;
+ glGetIntegerv(pname, &value);
+ logAllGLErrors(__FUNCTION__);
+ return QJSValue(glEnums(value));
+ }
+
+ case IMPLEMENTATION_COLOR_READ_FORMAT:
+ return QJSValue(QJSValue::UndefinedValue);
+ case IMPLEMENTATION_COLOR_READ_TYPE:
+ return QJSValue(QJSValue::UndefinedValue);
+ case UNPACK_COLORSPACE_CONVERSION_WEBGL:
+ return QJSValue(BROWSER_DEFAULT_WEBGL);
+
+ // Float32Array (with 2 elements)
+ // Intentional flow through
+ case ALIASED_LINE_WIDTH_RANGE:
+ case ALIASED_POINT_SIZE_RANGE:
+ case DEPTH_RANGE: {
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::ArrayBuffer> buffer(scope, m_v4engine->memoryManager->alloc<QV4::ArrayBuffer>(m_v4engine, sizeof(float) * 2));
+ glGetFloatv(pname, (float *) buffer->data());
+ logAllGLErrors(__FUNCTION__);
+
+ QV4::ScopedFunctionObject constructor(scope, m_v4engine->typedArrayCtors[QV4::Heap::TypedArray::Float32Array]);
+ QV4::ScopedCallData callData(scope, 1);
+ callData->args[0] = buffer;
+ return QJSValue(m_v4engine, constructor->construct(callData));
+ }
+
+ // Float32Array (with 4 values)
+ // Intentional flow through
+ case BLEND_COLOR:
+ case COLOR_CLEAR_VALUE: {
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::ArrayBuffer> buffer(scope, m_v4engine->memoryManager->alloc<QV4::ArrayBuffer>(m_v4engine, sizeof(float) * 4));
+ glGetFloatv(pname, (float *) buffer->data());
+ logAllGLErrors(__FUNCTION__);
+
+ QV4::ScopedFunctionObject constructor(scope, m_v4engine->typedArrayCtors[QV4::Heap::TypedArray::Float32Array]);
+ QV4::ScopedCallData callData(scope, 1);
+ callData->args[0] = buffer;
+ return QJSValue(m_v4engine, constructor->construct(callData));
+ }
+
+ // Int32Array (with 2 elements)
+ case MAX_VIEWPORT_DIMS: {
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::ArrayBuffer> buffer(scope, m_v4engine->memoryManager->alloc<QV4::ArrayBuffer>(m_v4engine, sizeof(int) * 2));
+ glGetIntegerv(pname, (int *) buffer->data());
+ logAllGLErrors(__FUNCTION__);
+
+ QV4::ScopedFunctionObject constructor(scope, m_v4engine->typedArrayCtors[QV4::Heap::TypedArray::Int32Array]);
+ QV4::ScopedCallData callData(scope, 1);
+ callData->args[0] = buffer;
+ return QJSValue(m_v4engine, constructor->construct(callData));
+ }
+
+ break;
+ // Int32Array (with 4 elements)
+ // Intentional flow through
+ case SCISSOR_BOX:
+ case VIEWPORT: {
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::ArrayBuffer> buffer(scope, m_v4engine->memoryManager->alloc<QV4::ArrayBuffer>(m_v4engine, sizeof(int) * 4));
+ glGetIntegerv(pname, (int *) buffer->data());
+ logAllGLErrors(__FUNCTION__);
+
+ QV4::ScopedFunctionObject constructor(scope, m_v4engine->typedArrayCtors[QV4::Heap::TypedArray::Int32Array]);
+ QV4::ScopedCallData callData(scope, 1);
+ callData->args[0] = buffer;
+ return QJSValue(m_v4engine, constructor->construct(callData));
+ }
+
+ // sequence<GLboolean> (with 4 values)
+ // Intentional flow through
+ case COLOR_WRITEMASK: {
+ GLboolean values[4];
+ glGetBooleanv(COLOR_WRITEMASK, values);
+ logAllGLErrors(__FUNCTION__);
+ QJSValue arrayValue = m_engine->newArray(4);
+ arrayValue.setProperty(0, values[0]);
+ arrayValue.setProperty(1, values[1]);
+ arrayValue.setProperty(2, values[2]);
+ arrayValue.setProperty(3, values[3]);
+ return arrayValue;
+ }
+
+ // GLfloat values
// Intentional flow through
+ case DEPTH_CLEAR_VALUE:
+ case LINE_WIDTH:
+ case POLYGON_OFFSET_FACTOR:
+ case POLYGON_OFFSET_UNITS:
+ case SAMPLE_COVERAGE_VALUE: {
+ GLfloat value;
+ glGetFloatv(pname, &value);
+ logAllGLErrors(__FUNCTION__);
+ return QJSValue(float(value));
+ }
+
+ // DomString values
+ // Intentional flow through
+ case RENDERER:
+ case SHADING_LANGUAGE_VERSION:
+ case VENDOR:
case VERSION: {
const GLubyte *text = glGetString(pname);
logAllGLErrors(__FUNCTION__);
QString qtext = QString::fromLatin1((const char *)text);
if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ << "():" << qtext;
- return qtext;
- break;
+ return QJSValue(qtext);
}
case UNMASKED_VENDOR_WEBGL: {
const GLubyte *text = glGetString(GL_VENDOR);
logAllGLErrors(__FUNCTION__);
QString qtext = QString::fromLatin1((const char *)text);
if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ << "():" << qtext;
- return qtext;
+ return QJSValue(qtext);
}
case UNMASKED_RENDERER_WEBGL: {
const GLubyte *text = glGetString(GL_VENDOR);
logAllGLErrors(__FUNCTION__);
QString qtext = QString::fromLatin1((const char *)text);
if (m_logAllCalls) qDebug() << "Context3D::" << __FUNCTION__ << "():" << qtext;
- return qtext;
+ return QJSValue(qtext);
+ }
+ case COMPRESSED_TEXTURE_FORMATS: {
+ GLint numFormats;
+ glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);
+ if (numFormats > 0) {
+ QV4::Scope scope(m_v4engine);
+ QV4::Scoped<QV4::ArrayBuffer> buffer(scope,
+ m_v4engine->memoryManager->alloc<QV4::ArrayBuffer>(
+ m_v4engine,
+ sizeof(int) * numFormats));
+ glGetIntegerv(pname, (int *) buffer->data());
+ logAllGLErrors(__FUNCTION__);
+
+ QV4::ScopedFunctionObject constructor(scope, m_v4engine->typedArrayCtors[QV4::Heap::TypedArray::Int32Array]);
+ QV4::ScopedCallData callData(scope, 1);
+ callData->args[0] = buffer;
+ return QJSValue(m_v4engine, constructor->construct(callData));
+ }
}
default: {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< "(): UNIMPLEMENTED PARAMETER NAME" << glEnumToString(pname);
- return QVariant::fromValue(0);
+ return QJSValue(QJSValue::NullValue);
}
}
- // TODO: Check if this handles ownership correctly
- return QVariant::fromValue(QString("NOT SUPPORTED YET"));
+ return QJSValue(QJSValue::NullValue);
}
/*!
@@ -5182,11 +5485,11 @@ QVariant CanvasContext::getTexParameter(glEnums target, glEnums pname)
<< ")";
GLint parameter = 0;
- if (!m_currentTexture) {
+ if (!m_currentTexture2D) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION No current texture bound";
m_error = INVALID_OPERATION;
- } else if (!m_currentTexture->isAlive()) {
+ } else if (!m_currentTexture2D->isAlive()) {
if (m_logAllErrors) qDebug() << "Context3D::" << __FUNCTION__
<< ":INVALID_OPERATION Currently bound texture is deleted";
m_error = INVALID_OPERATION;
@@ -5592,7 +5895,7 @@ QVariantList CanvasContext::getSupportedExtensions()
}
/*!
- * \internal TODO: Remove once TypedArrays are in V4VM
+ * \internal
*/
bool CanvasContext::isOfType(const QJSValue &value, const QString &classname) const
{
@@ -5644,3 +5947,4 @@ QVariant CanvasContext::getExtension(const QString &name)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/context3d_p.h b/src/context3d_p.h
index c22477d..10e6f70 100644
--- a/src/context3d_p.h
+++ b/src/context3d_p.h
@@ -53,17 +53,21 @@
#include "canvasglstatedump_p.h"
#include <QtGui/QOpenGLFunctions>
-#include <QString>
-#include <QRect>
-#include <QSize>
-#include <QSet>
-#include <QVariantList>
+#include <QtCore/QString>
+#include <QtCore/QRect>
+#include <QtCore/QSize>
+#include <QtCore/QSet>
+#include <QtCore/QVariantList>
#include <QtQuick/QQuickItem>
+#include <QtQml>
+#include <QtQml/QJSEngine>
+#include <QtQml/private/qqmlengine_p.h>
#ifdef NO_ERROR // may de defined in winerror.h
#undef NO_ERROR
#endif
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
#define ENUM_AS_PROPERTY(A) Q_PROPERTY(QtCanvas3D::CanvasContext::glEnums A READ A ## _read); inline QtCanvas3D::CanvasContext::glEnums A ## _read() { return CanvasContext::A; }
@@ -78,16 +82,10 @@ class CanvasProgram;
class CanvasBuffer;
class CanvasUniformLocation;
class CanvasTextureImage;
-class CanvasArrayBufferView;
-class CanvasArrayBuffer;
-class CanvasFloat32Array;
-class CanvasInt32Array;
-class CanvasUint16Array;
-class CanvasUint8Array;
-class CanvasTypedArray;
class CanvasShaderPrecisionFormat;
class EnumToStringMap;
+
class QT_CANVAS3D_EXPORT CanvasContext : public CanvasAbstractObject, protected QOpenGLFunctions
{
Q_OBJECT
@@ -456,6 +454,10 @@ public:
VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,
VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F,
+ /* Read Format */
+ IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A,
+ IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B,
+
/* Shader Source */
COMPILE_STATUS = 0x8B81,
@@ -879,6 +881,10 @@ public:
ENUM_AS_PROPERTY(VERTEX_ATTRIB_ARRAY_POINTER)
ENUM_AS_PROPERTY(VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)
+ /* Read Format */
+ ENUM_AS_PROPERTY(IMPLEMENTATION_COLOR_READ_TYPE)
+ ENUM_AS_PROPERTY(IMPLEMENTATION_COLOR_READ_FORMAT)
+
/* Shader Source */
ENUM_AS_PROPERTY(COMPILE_STATUS)
@@ -1111,7 +1117,7 @@ public:
Q_INVOKABLE bool isEnabled(glEnums cap);
Q_INVOKABLE void disable(glEnums cap);
- Q_INVOKABLE QVariant getParameter(glEnums pname);
+ Q_INVOKABLE QJSValue getParameter(glEnums pname);
Q_INVOKABLE void clear(glEnums flags);
Q_INVOKABLE void depthMask(bool flag);
@@ -1197,7 +1203,6 @@ private:
QString glEnumToString(glEnums value) const;
float devicePixelRatio();
void setDevicePixelRatio(float ratio);
- CanvasTypedArray *createTypedArray(glEnums dataType, long size);
int getSufficientSize(glEnums internalFormat, int width, int height);
QRect glViewportRect() const;
@@ -1214,6 +1219,7 @@ private:
private:
QQmlEngine *m_engine;
+ QV4::ExecutionEngine *m_v4engine;
bool m_unpackFlipYEnabled;
bool m_unpackPremultiplyAlphaEnabled;
@@ -1226,7 +1232,8 @@ private:
CanvasProgram *m_currentProgram;
CanvasBuffer *m_currentArrayBuffer;
CanvasBuffer *m_currentElementArrayBuffer;
- CanvasTexture *m_currentTexture;
+ CanvasTexture *m_currentTexture2D;
+ CanvasTexture *m_currentTextureCubeMap;
QOpenGLContext *m_context;
QSet<QByteArray> m_extensions;
QSurface *m_surface;
@@ -1250,5 +1257,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // CONTEXT3D_P_H
diff --git a/src/contextattributes.cpp b/src/contextattributes.cpp
index c7df9b6..422fb45 100644
--- a/src/contextattributes.cpp
+++ b/src/contextattributes.cpp
@@ -39,6 +39,7 @@
#include <QVariantMap>
#include <QDebug>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -284,3 +285,4 @@ QDebug operator<<(QDebug dbg, const CanvasContextAttributes &attribs)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/contextattributes_p.h b/src/contextattributes_p.h
index 6d3f701..af67a05 100644
--- a/src/contextattributes_p.h
+++ b/src/contextattributes_p.h
@@ -51,6 +51,7 @@
#include <QObject>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasContextAttributes : public CanvasAbstractObject
@@ -114,5 +115,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // QCONTEXTATTRIBUTES_P_H
diff --git a/src/contextextensions.cpp b/src/contextextensions.cpp
index 3de546e..51038f9 100644
--- a/src/contextextensions.cpp
+++ b/src/contextextensions.cpp
@@ -36,6 +36,7 @@
#include "contextextensions_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
WEBGL_debug_renderer_info::WEBGL_debug_renderer_info(QObject *parent) :
@@ -44,3 +45,4 @@ WEBGL_debug_renderer_info::WEBGL_debug_renderer_info(QObject *parent) :
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/contextextensions_p.h b/src/contextextensions_p.h
index 895f806..d70aa7b 100644
--- a/src/contextextensions_p.h
+++ b/src/contextextensions_p.h
@@ -50,6 +50,7 @@
#include "context3d_p.h"
#include "canvas3dcommon_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class WEBGL_debug_renderer_info : public QObject
@@ -64,5 +65,6 @@ class WEBGL_debug_renderer_info : public QObject
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // CONTEXTEXTENSIONS_P_H
diff --git a/src/enumtostringmap.cpp b/src/enumtostringmap.cpp
index 92a4dd0..0bd741a 100644
--- a/src/enumtostringmap.cpp
+++ b/src/enumtostringmap.cpp
@@ -36,6 +36,7 @@
#include "enumtostringmap_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
static EnumToStringMap *theInstance = 0;
@@ -427,3 +428,4 @@ QString EnumToStringMap::lookUp(const GLuint value) const
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/enumtostringmap_p.h b/src/enumtostringmap_p.h
index 1021c28..0dbad80 100644
--- a/src/enumtostringmap_p.h
+++ b/src/enumtostringmap_p.h
@@ -51,6 +51,7 @@
#include <QMap>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class EnumToStringMap
@@ -68,5 +69,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // ENUMTOSTRINGMAP_P_H
diff --git a/src/framebuffer3d.cpp b/src/framebuffer3d.cpp
index 3a99c69..6d45bee 100644
--- a/src/framebuffer3d.cpp
+++ b/src/framebuffer3d.cpp
@@ -36,6 +36,7 @@
#include "framebuffer3d_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -107,3 +108,4 @@ QDebug operator<<(QDebug dbg, const CanvasFrameBuffer *buffer)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/framebuffer3d_p.h b/src/framebuffer3d_p.h
index 0dc3828..9b344df 100644
--- a/src/framebuffer3d_p.h
+++ b/src/framebuffer3d_p.h
@@ -52,6 +52,7 @@
#include <QOpenGLFunctions>
#include <QDebug>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasFrameBuffer : public CanvasAbstractObject, protected QOpenGLFunctions
@@ -73,5 +74,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // FRAMEBUFFER3D_P_H
diff --git a/src/plugins.qmltypes b/src/plugins.qmltypes
index 55ca670..25e7e55 100644
--- a/src/plugins.qmltypes
+++ b/src/plugins.qmltypes
@@ -98,56 +98,6 @@ Module {
}
}
Component {
- name: "QtCanvas3D::CanvasArrayBuffer"
- prototype: "QObject"
- exports: ["QtCanvas3D/ArrayBuffer 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "byteLength"; type: "ulong"; isReadonly: true }
- Signal {
- name: "byteLengthChanged"
- Parameter { name: "byteLength"; type: "ulong" }
- }
- Method {
- name: "slice"
- type: "CanvasArrayBuffer*"
- Parameter { name: "begin"; type: "long" }
- }
- Method {
- name: "slice"
- type: "CanvasArrayBuffer*"
- Parameter { name: "begin"; type: "long" }
- Parameter { name: "end"; type: "long" }
- }
- Method {
- name: "isView"
- type: "bool"
- Parameter { name: "value"; type: "QObject" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasArrayBufferView"
- prototype: "QtCanvas3D::CanvasAbstractObject"
- exports: ["QtCanvas3D/ArrayBufferView 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "buffer"; type: "CanvasArrayBuffer"; isReadonly: true; isPointer: true }
- Property { name: "byteOffset"; type: "ulong"; isReadonly: true }
- Property { name: "byteLength"; type: "ulong"; isReadonly: true }
- Signal {
- name: "bufferChanged"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- }
- Signal {
- name: "byteOffsetChanged"
- Parameter { name: "byteLength"; type: "ulong" }
- }
- Signal {
- name: "byteLengthChanged"
- Parameter { name: "byteLength"; type: "ulong" }
- }
- }
- Component {
name: "QtCanvas3D::CanvasBuffer"
prototype: "QtCanvas3D::CanvasAbstractObject"
exports: ["QtCanvas3D/Buffer3D 1.0"]
@@ -2121,58 +2071,6 @@ Module {
}
}
Component {
- name: "QtCanvas3D::CanvasFloat32Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Float32Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "float"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "float" }
- }
- Method {
- name: "set"
- Parameter { name: "array"; type: "QVariantList" }
- Parameter { name: "offset"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "set"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- Parameter { name: "offset"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasFloat64Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Float64Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "double"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "double" }
- }
- }
- Component {
name: "QtCanvas3D::CanvasFrameBuffer"
prototype: "QtCanvas3D::CanvasAbstractObject"
exports: ["QtCanvas3D/FrameBuffer3D 1.0"]
@@ -2222,57 +2120,6 @@ Module {
Method { name: "getGLStateDump"; type: "string" }
}
Component {
- name: "QtCanvas3D::CanvasInt16Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Int16Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "short"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "short" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasInt32Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Int32Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "int"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "int" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasInt8Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Int8Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "signed char"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "signed char" }
- }
- }
- Component {
name: "QtCanvas3D::CanvasProgram"
prototype: "QtCanvas3D::CanvasAbstractObject"
exports: ["QtCanvas3D/Program3D 1.0"]
@@ -2397,283 +2244,6 @@ Module {
Method { name: "newTexImage"; type: "CanvasTextureImage*" }
}
Component {
- name: "QtCanvas3D::CanvasTypedArray"
- prototype: "QtCanvas3D::CanvasArrayBufferView"
- exports: ["QtCanvas3D/TypedArray 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "length"; type: "ulong"; isReadonly: true }
- Signal {
- name: "lengthChanged"
- Parameter { name: "length"; type: "ulong" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasTypedArrayFactory"
- prototype: "QObject"
- exports: ["QtCanvas3D/Arrays 1.0"]
- isCreatable: false
- isSingleton: true
- exportMetaObjectRevisions: [0]
- Method {
- name: "newInt8Array"
- type: "CanvasInt8Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newInt8Array"
- type: "CanvasInt8Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newInt8Array"
- type: "CanvasInt8Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newInt8Array"
- type: "CanvasInt8Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newUint8Array"
- type: "CanvasUint8Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newUint8Array"
- type: "CanvasUint8Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newUint8Array"
- type: "CanvasUint8Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newUint8Array"
- type: "CanvasUint8Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newInt16Array"
- type: "CanvasInt16Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newInt16Array"
- type: "CanvasInt16Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newInt16Array"
- type: "CanvasInt16Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newInt16Array"
- type: "CanvasInt16Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newUint16Array"
- type: "CanvasUint16Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newUint16Array"
- type: "CanvasUint16Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newUint16Array"
- type: "CanvasUint16Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newUint16Array"
- type: "CanvasUint16Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newInt32Array"
- type: "CanvasInt32Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newInt32Array"
- type: "CanvasInt32Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newInt32Array"
- type: "CanvasInt32Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newInt32Array"
- type: "CanvasInt32Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newUint32Array"
- type: "CanvasUint32Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newUint32Array"
- type: "CanvasUint32Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newUint32Array"
- type: "CanvasUint32Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newUint32Array"
- type: "CanvasUint32Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newFloat32Array"
- type: "CanvasFloat32Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newFloat32Array"
- type: "CanvasFloat32Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newFloat32Array"
- type: "CanvasFloat32Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newFloat32Array"
- type: "CanvasFloat32Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newFloat64Array"
- type: "CanvasFloat64Array*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newFloat64Array"
- type: "CanvasFloat64Array*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newFloat64Array"
- type: "CanvasFloat64Array*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newFloat64Array"
- type: "CanvasFloat64Array*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- Method {
- name: "newUint8ClampedArray"
- type: "CanvasUint8ClampedArray*"
- Parameter { name: "length"; type: "ulong" }
- }
- Method {
- name: "newUint8ClampedArray"
- type: "CanvasUint8ClampedArray*"
- Parameter { name: "array"; type: "CanvasTypedArray"; isPointer: true }
- }
- Method {
- name: "newUint8ClampedArray"
- type: "CanvasUint8ClampedArray*"
- Parameter { name: "array"; type: "QVariantList" }
- }
- Method {
- name: "newUint8ClampedArray"
- type: "CanvasUint8ClampedArray*"
- Parameter { name: "buffer"; type: "CanvasArrayBuffer"; isPointer: true }
- Parameter { name: "byteOffset"; type: "ulong" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasUint16Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Uint16Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "ushort"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "ushort" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasUint32Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Uint32Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "uint"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "uint" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasUint8Array"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Uint8Array 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "uchar"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "uchar" }
- }
- }
- Component {
- name: "QtCanvas3D::CanvasUint8ClampedArray"
- prototype: "QtCanvas3D::CanvasTypedArray"
- exports: ["QtCanvas3D/Uint8ClampedArray 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Method {
- name: "get"
- type: "uchar"
- Parameter { name: "index"; type: "ulong" }
- }
- Method {
- name: "set"
- Parameter { name: "index"; type: "ulong" }
- Parameter { name: "value"; type: "uchar" }
- }
- }
- Component {
name: "QtCanvas3D::CanvasUniformLocation"
prototype: "QtCanvas3D::CanvasAbstractObject"
exports: ["QtCanvas3D/UniformLocation3D 1.0"]
diff --git a/src/program3d.cpp b/src/program3d.cpp
index c902587..8777e2d 100644
--- a/src/program3d.cpp
+++ b/src/program3d.cpp
@@ -36,6 +36,7 @@
#include "program3d_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -221,3 +222,4 @@ QDebug operator<<(QDebug dbg, const CanvasProgram *program)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/program3d_p.h b/src/program3d_p.h
index 387b6fa..d57afc9 100644
--- a/src/program3d_p.h
+++ b/src/program3d_p.h
@@ -56,6 +56,7 @@
#include <QDebug>
#include <QList>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasProgram : public CanvasAbstractObject, protected QOpenGLFunctions
@@ -91,5 +92,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // PROGRAM3D_P_H
diff --git a/src/qcanvas3d_plugin.cpp b/src/qcanvas3d_plugin.cpp
index fec0a73..7baeb2b 100644
--- a/src/qcanvas3d_plugin.cpp
+++ b/src/qcanvas3d_plugin.cpp
@@ -38,6 +38,7 @@
#include <QtQml/qqml.h>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
void QtCanvas3DPlugin::registerTypes(const char *uri)
@@ -105,61 +106,7 @@ void QtCanvas3DPlugin::registerTypes(const char *uri)
1, 0,
"GLStateDumpExt",
QLatin1String("Trying to create uncreatable: GLStateDumpExt, use Context3D.getExtension(\"" QT_CANVAS3D_GL_STATE_DUMP_EXT_NAME "\") instead."));
-
-
- // TYPED ARRAY IMPLEMENTATION TODO: Remove these by Qt 5.5
- qmlRegisterSingletonType<CanvasTypedArrayFactory>(uri,
- 1, 0,
- "Arrays",
- CanvasTypedArrayFactory::type_array_factory_provider);
- qmlRegisterUncreatableType<CanvasTypedArray>(uri,
- 1, 0,
- "TypedArray",
- QLatin1String("Trying to create uncreatable: TypedArray."));
- qmlRegisterUncreatableType<CanvasArrayBufferView>(uri,
- 1, 0,
- "ArrayBufferView",
- QLatin1String("Trying to create uncreatable: ArrayBufferView."));
- qmlRegisterUncreatableType<CanvasArrayBuffer>(uri,
- 1, 0,
- "ArrayBuffer",
- QLatin1String("Trying to create uncreatable: ArrayBuffer."));
- qmlRegisterUncreatableType<CanvasInt8Array>(uri,
- 1, 0,
- "Int8Array",
- QLatin1String("Trying to create uncreatable: Int8Array, use Arrays.newInt8Array() instead."));
- qmlRegisterUncreatableType<CanvasUint8Array>(uri,
- 1, 0,
- "Uint8Array",
- QLatin1String("Trying to create uncreatable: Uint8Array, use Arrays.newUint8Array() instead."));
- qmlRegisterUncreatableType<CanvasUint8ClampedArray>(uri,
- 1, 0,
- "Uint8ClampedArray",
- QLatin1String("Trying to create uncreatable: Uint8ClampedArray, use Arrays.newUint8ClampedArray() instead."));
- qmlRegisterUncreatableType<CanvasInt16Array>(uri,
- 1, 0,
- "Int16Array",
- QLatin1String("Trying to create uncreatable: Int16Array, use Arrays.newInt16Array() instead."));
- qmlRegisterUncreatableType<CanvasUint16Array>(uri,
- 1, 0,
- "Uint16Array",
- QLatin1String("Trying to create uncreatable: Uint16Array, use Arrays.newUint16Array() instead."));
- qmlRegisterUncreatableType<CanvasInt32Array>(uri,
- 1, 0,
- "Int32Array",
- QLatin1String("Trying to create uncreatable: Int32Array, use Arrays.newInt32Array() instead."));
- qmlRegisterUncreatableType<CanvasUint32Array>(uri,
- 1, 0,
- "Uint32Array",
- QLatin1String("Trying to create uncreatable: Uint32Array, use Arrays.newUint32Array() instead."));
- qmlRegisterUncreatableType<CanvasFloat32Array>(uri,
- 1, 0,
- "Float32Array",
- QLatin1String("Trying to create uncreatable: Float32Array, use Arrays.newFloat32Array() instead."));
- qmlRegisterUncreatableType<CanvasFloat64Array>(uri,
- 1, 0,
- "Float64Array",
- QLatin1String("Trying to create uncreatable: Float64Array, use Arrays.newFloat64Array() instead."));
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/qcanvas3d_plugin.h b/src/qcanvas3d_plugin.h
index d6af392..1329425 100644
--- a/src/qcanvas3d_plugin.h
+++ b/src/qcanvas3d_plugin.h
@@ -24,8 +24,8 @@
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
@@ -51,25 +51,12 @@
#include "shaderprecisionformat_p.h"
#include "activeinfo3d_p.h"
#include "canvasglstatedump_p.h"
-#include "typedarray/typedarrayfactory_p.h"
-#include "typedarray/typedarray_p.h"
-#include "typedarray/arraybuffer_p.h"
-#include "typedarray/arraybufferview_p.h"
-#include "typedarray/int8array_p.h"
-#include "typedarray/uint8array_p.h"
-#include "typedarray/int16array_p.h"
-#include "typedarray/uint16array_p.h"
-#include "typedarray/int32array_p.h"
-#include "typedarray/uint32array_p.h"
-#include "typedarray/float32array_p.h"
-#include "typedarray/float64array_p.h"
-#include "typedarray/uint8clampedarray_p.h"
#include <QQmlExtensionPlugin>
using namespace QtCanvas3D;
-Q_DECLARE_METATYPE(CanvasBuffer)
+Q_DECLARE_METATYPE(QtCanvas3D::CanvasBuffer)
QML_DECLARE_TYPE(Canvas)
QML_DECLARE_TYPE(CanvasContext)
@@ -78,21 +65,8 @@ QML_DECLARE_TYPE(CanvasShader)
QML_DECLARE_TYPE(CanvasProgram)
QML_DECLARE_TYPE(CanvasBuffer)
QML_DECLARE_TYPE(CanvasUniformLocation)
-QML_DECLARE_TYPE(CanvasFloat32Array)
-QML_DECLARE_TYPE(CanvasFloat64Array)
-QML_DECLARE_TYPE(CanvasInt8Array)
-QML_DECLARE_TYPE(CanvasUint8Array)
-QML_DECLARE_TYPE(CanvasUint8ClampedArray)
-QML_DECLARE_TYPE(CanvasInt16Array)
-QML_DECLARE_TYPE(CanvasUint16Array)
-QML_DECLARE_TYPE(CanvasInt32Array)
-QML_DECLARE_TYPE(CanvasUint32Array)
-QML_DECLARE_TYPE(CanvasArrayBufferView)
-QML_DECLARE_TYPE(CanvasArrayBuffer)
-QML_DECLARE_TYPE(CanvasTypedArrayFactory)
QML_DECLARE_TYPE(CanvasTextureImage)
QML_DECLARE_TYPE(CanvasTextureImageFactory)
-QML_DECLARE_TYPE(CanvasTypedArray)
QML_DECLARE_TYPE(CanvasContextAttributes)
QML_DECLARE_TYPE(CanvasFrameBuffer)
QML_DECLARE_TYPE(CanvasRenderBuffer)
@@ -100,6 +74,7 @@ QML_DECLARE_TYPE(CanvasShaderPrecisionFormat)
QML_DECLARE_TYPE(CanvasActiveInfo)
QML_DECLARE_TYPE(CanvasGLStateDump)
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class QtCanvas3DPlugin : public QQmlExtensionPlugin
@@ -112,6 +87,7 @@ public:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // QCANVAS3D_PLUGIN_H
diff --git a/src/renderbuffer3d.cpp b/src/renderbuffer3d.cpp
index 19444e5..c9d257c 100644
--- a/src/renderbuffer3d.cpp
+++ b/src/renderbuffer3d.cpp
@@ -36,6 +36,7 @@
#include "renderbuffer3d_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -95,3 +96,4 @@ GLuint CanvasRenderBuffer::id()
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/renderbuffer3d_p.h b/src/renderbuffer3d_p.h
index 360e33d..7f4ebb0 100644
--- a/src/renderbuffer3d_p.h
+++ b/src/renderbuffer3d_p.h
@@ -52,6 +52,7 @@
#include <QObject>
#include <QOpenGLFunctions>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasRenderBuffer : public CanvasAbstractObject, protected QOpenGLFunctions
@@ -69,5 +70,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // RENDERBUFFER3D_P_H
diff --git a/src/shader3d.cpp b/src/shader3d.cpp
index 77edb7b..8f622cd 100644
--- a/src/shader3d.cpp
+++ b/src/shader3d.cpp
@@ -36,6 +36,7 @@
#include "shader3d_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -116,3 +117,4 @@ void CanvasShader::setSourceCode(const QString &source)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/shader3d_p.h b/src/shader3d_p.h
index 0339d95..7d5ea00 100644
--- a/src/shader3d_p.h
+++ b/src/shader3d_p.h
@@ -52,6 +52,7 @@
#include <QOpenGLShader>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasShader : public CanvasAbstractObject
@@ -75,5 +76,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // SHADER3D_P_H
diff --git a/src/shaderprecisionformat.cpp b/src/shaderprecisionformat.cpp
index e11c280..9370b00 100644
--- a/src/shaderprecisionformat.cpp
+++ b/src/shaderprecisionformat.cpp
@@ -36,6 +36,7 @@
#include "shaderprecisionformat_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -74,3 +75,4 @@ CanvasShaderPrecisionFormat::CanvasShaderPrecisionFormat(QObject *parent) :
*/
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/shaderprecisionformat_p.h b/src/shaderprecisionformat_p.h
index 8185aa1..4e10725 100644
--- a/src/shaderprecisionformat_p.h
+++ b/src/shaderprecisionformat_p.h
@@ -51,6 +51,7 @@
#include <QObject>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasShaderPrecisionFormat : public CanvasAbstractObject
@@ -83,5 +84,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // SHADERPRECISIONFORMAT_P_H
diff --git a/src/src.pro b/src/src.pro
index 9470673..379d199 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -2,7 +2,7 @@ load(qt_parts)
TEMPLATE = lib
TARGET = qtcanvas3d
-QT += qml quick
+QT += qml quick qml-private core-private
DEFINES += QTCANVAS3D_LIBRARY
TARGETPATH = QtCanvas3D
IMPORT_VERSION = $$MODULE_VERSION
@@ -14,21 +14,8 @@ include($$PWD/designer/designer.pri)
QMAKE_DOCS = $$PWD/doc/qtcanvas3d.qdocconf
-SOURCES += typedarray/arraybuffer.cpp \
- typedarray/arraybufferview.cpp \
- typedarray/float32array.cpp \
- typedarray/uint8array.cpp \
- typedarray/uint16array.cpp \
- typedarray/int8array.cpp \
- typedarray/int16array.cpp \
- typedarray/int32array.cpp \
- typedarray/uint32array.cpp \
- typedarray/float64array.cpp \
- typedarray/typedarrayfactory.cpp \
- typedarray/typedarray.cpp \
- typedarray/uint8clampedarray.cpp \
+SOURCES += arrayutils.cpp \
qcanvas3d_plugin.cpp \
- arrayutils.cpp \
enumtostringmap.cpp \
abstractobject3d.cpp \
canvas3d.cpp \
@@ -48,20 +35,7 @@ SOURCES += typedarray/arraybuffer.cpp \
activeinfo3d.cpp \
canvasglstatedump.cpp
-HEADERS += typedarray/arraybuffer_p.h \
- typedarray/arraybufferview_p.h \
- typedarray/float32array_p.h \
- typedarray/uint8array_p.h \
- typedarray/uint16array_p.h \
- typedarray/int8array_p.h \
- typedarray/int16array_p.h \
- typedarray/int32array_p.h \
- typedarray/uint32array_p.h \
- typedarray/float64array_p.h \
- typedarray/typedarrayfactory_p.h \
- typedarray/typedarray_p.h \
- typedarray/arrayutils_p.h \
- typedarray/uint8clampedarray_p.h \
+HEADERS += arrayutils_p.h \
qcanvas3d_plugin.h \
enumtostringmap_p.h \
abstractobject3d_p.h \
diff --git a/src/teximage3d.cpp b/src/teximage3d.cpp
index 4fd4893..8bc107a 100644
--- a/src/teximage3d.cpp
+++ b/src/teximage3d.cpp
@@ -40,6 +40,7 @@
#include <QJSValueIterator>
#include <QtQml/QQmlEngine>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
static QMap<QQmlEngine *,CanvasTextureImageFactory *>m_qmlEngineToImageFactoryMap;
@@ -536,3 +537,4 @@ QDebug operator<<(QDebug dbg, const CanvasTextureImage *texImage)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/teximage3d_p.h b/src/teximage3d_p.h
index 876b1e7..1a8629a 100644
--- a/src/teximage3d_p.h
+++ b/src/teximage3d_p.h
@@ -55,6 +55,7 @@
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasTextureImageFactory : public QObject
@@ -154,5 +155,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // TEXIMAGE3D_P_H
diff --git a/src/texture3d.cpp b/src/texture3d.cpp
index a7dfd92..3d7d015 100644
--- a/src/texture3d.cpp
+++ b/src/texture3d.cpp
@@ -36,6 +36,7 @@
#include "texture3d_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -122,3 +123,4 @@ QDebug operator<<(QDebug dbg, const CanvasTexture *texture)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/texture3d_p.h b/src/texture3d_p.h
index e7199e8..2aba522 100644
--- a/src/texture3d_p.h
+++ b/src/texture3d_p.h
@@ -53,6 +53,7 @@
#include <QtGui/QOpenGLTexture>
#include <QtGui/QOpenGLFunctions>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasTexture : public CanvasAbstractObject, protected QOpenGLFunctions
@@ -76,5 +77,6 @@ public:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // TEXTURE3D_P_H
diff --git a/src/typedarray/arraybuffer.cpp b/src/typedarray/arraybuffer.cpp
deleted file mode 100644
index 90f6c00..0000000
--- a/src/typedarray/arraybuffer.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype ArrayBuffer
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains an array buffer.
- *
- * An uncreatable QML type that contains an array buffer.
- */
-
-/*!
- * \internal
- */
-CanvasArrayBuffer::CanvasArrayBuffer(QObject *parent) :
- QObject(parent),
- m_length(0),
- m_rawData(0)
-{
-}
-
-/*!
- * \internal
- */
-CanvasArrayBuffer::CanvasArrayBuffer(unsigned long length, QObject *parent) :
- QObject(parent),
- m_length(length),
- m_rawData(0)
-{
- if (length > 0) {
- m_rawData = new unsigned char[length];
- for (unsigned long i = 0; i < length; i++)
- m_rawData[i] = 0;
- }
- emit byteLengthChanged(length);
-}
-
-/*!
- * \internal
- */
-CanvasArrayBuffer::~CanvasArrayBuffer()
-{
- delete[] m_rawData;
-}
-
-/*!
- * \internal
- */
-unsigned char *CanvasArrayBuffer::rawData()
-{
- return m_rawData;
-}
-
-/*!
- * \internal
- */
-void CanvasArrayBuffer::copyRawDataFrom(unsigned char *rawData, unsigned long byteLength)
-{
- if (m_length != byteLength) {
- delete m_rawData;
- m_rawData = 0;
- m_length = 0;
- }
-
- m_rawData = new unsigned char[byteLength];
- m_length = byteLength;
-
- for (unsigned long i = 0; i < byteLength; i++)
- m_rawData[i] = rawData[i];
-}
-
-/*!
- * \qmlproperty int ArrayBuffer::byteLength()
- * Contains the length of the array in bytes.
- */
-/*!
- * \internal
- */
-unsigned long CanvasArrayBuffer::byteLength() const
-{
- return m_length;
-}
-
-/*!
- * \qmlmethod ArrayBuffer ArrayBuffer::slice(int begin)
- * Returns a new ArrayBuffer that is a copy of this ArrayBuffer's bytes from the \a begin to the
- * end of the buffer.
- */
-/*!
- * \internal
- */
-CanvasArrayBuffer *CanvasArrayBuffer::slice(long begin)
-{
- return slice(begin, m_length);
-}
-
-/*!
- * \qmlmethod ArrayBuffer ArrayBuffer::slice(int begin, int end)
- * Returns a new ArrayBuffer that is a copy of this ArrayBuffer's bytes from the \a begin to the
- * \a end.
- */
-/*!
- * \internal
- */
-CanvasArrayBuffer *CanvasArrayBuffer::slice(long begin, long end)
-{
- if (begin < 0)
- begin = m_length + begin - 1;
- if (end < 0)
- end = m_length + end - 1;
- long length = end - begin;
-
- if (length <= 0)
- return new CanvasArrayBuffer(0, 0);
-
- CanvasArrayBuffer *newBuffer = new CanvasArrayBuffer(length);
- for (long i = 0; i < length; i++)
- newBuffer->m_rawData[i] = m_rawData[i + begin];
- return newBuffer;
-}
-
-/*!
- * \qmlmethod bool ArrayBuffer::isView(Object value)
- * Returns \c true if \a value is ArrayBufferView and \c false otherwise.
- */
-/*!
- * \internal
- */
-bool CanvasArrayBuffer::isView(const QObject &value)
-{
- QString className = QString(value.metaObject()->className());
- return (className == "CanvasInt8Array" ||
- className == "CanvasUint8Array" ||
- className == "CanvasUint8ClampedArray" ||
- className == "CanvasInt16Array" ||
- className == "CanvasUint16Array" ||
- className == "CanvasInt32Array" ||
- className == "CanvasUint32Array" ||
- className == "CanvasFloat32Array" ||
- className == "CanvasFloat64Array");
-}
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/arraybuffer_p.h b/src/typedarray/arraybuffer_p.h
deleted file mode 100644
index 5845736..0000000
--- a/src/typedarray/arraybuffer_p.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef ARRAYBUFFER_P_H
-#define ARRAYBUFFER_P_H
-
-#include "../canvas3dcommon_p.h"
-#include <QObject>
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasArrayBuffer : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(CanvasArrayBuffer)
- Q_PROPERTY(unsigned long byteLength READ byteLength NOTIFY byteLengthChanged)
-
-public:
- explicit CanvasArrayBuffer(QObject *parent = 0);
- explicit CanvasArrayBuffer(unsigned long length, QObject *parent = 0);
- ~CanvasArrayBuffer();
-
- unsigned long byteLength() const;
- Q_INVOKABLE CanvasArrayBuffer *slice(long begin);
- Q_INVOKABLE CanvasArrayBuffer *slice(long begin, long end);
- Q_INVOKABLE bool isView(const QObject &value);
-
- void copyRawDataFrom(unsigned char *rawData, unsigned long byteLength);
-
-signals:
- void byteLengthChanged(unsigned long byteLength);
-
-public slots:
-
-private:
- unsigned char *rawData();
-
- unsigned long m_length;
- unsigned char *m_rawData;
-
- // Only the type based views have access to the modifiable rawData
- friend class CanvasInt8Array;
- friend class CanvasUint8Array;
- friend class CanvasInt16Array;
- friend class CanvasUint16Array;
- friend class CanvasInt32Array;
- friend class CanvasUint32Array;
- friend class CanvasFloat32Array;
- friend class CanvasFloat64Array;
- friend class CanvasUint8ClampedArray;
- friend class CanvasArrayBufferView;
- friend class CanvasTypedArray;
- friend class CanvasContext;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // ARRAYBUFFER_P_H
diff --git a/src/typedarray/arraybufferview.cpp b/src/typedarray/arraybufferview.cpp
deleted file mode 100644
index 1eb8b68..0000000
--- a/src/typedarray/arraybufferview.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "arraybufferview_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype ArrayBufferView
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains an array buffer view.
- *
- * An uncreatable QML type that contains a particular view to the data of an ArrayBuffer.
- */
-
-/*!
- * \internal
- */
-CanvasArrayBufferView::CanvasArrayBufferView(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasAbstractObject(parent),
- m_buffer(buffer),
- m_byteOffset(byteOffset)
-{
- if (m_buffer)
- m_buffer->setParent(this);
-}
-
-/*!
- * \internal
- */
-CanvasArrayBufferView::~CanvasArrayBufferView()
-{
- delete m_buffer;
-}
-
-/*!
- * \internal
- */
-unsigned char* CanvasArrayBufferView::rawDataCptr() const
-{
- if (!m_buffer)
- return 0;
-
- return m_buffer->m_rawData;
-}
-
-/*!
- * \qmlproperty int ArrayBufferView::byteOffset()
- * Contains the offset from the start of the ArrayBuffer of the view in bytes.
- */
-/*!
- * \internal
- */
-unsigned long CanvasArrayBufferView::byteOffset()
-{
- if (m_buffer)
- return m_byteOffset;
-
- return 0;
-}
-
-/*!
- * \qmlproperty int ArrayBufferView::byteLength()
- * Contains the length of the view in bytes.
- */
-/*!
- * \internal
- */
-unsigned long CanvasArrayBufferView::byteLength()
-{
- if (m_buffer)
- return m_buffer->byteLength();
-
- return 0;
-}
-
-/*!
- * \qmlproperty ArrayBuffer ArrayBufferView::buffer()
- * Contains the ArrayBuffer of the view.
- */
-/*!
- * \internal
- */
-CanvasArrayBuffer *CanvasArrayBufferView::buffer()
-{
- return m_buffer;
-}
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/arraybufferview_p.h b/src/typedarray/arraybufferview_p.h
deleted file mode 100644
index 5783ee7..0000000
--- a/src/typedarray/arraybufferview_p.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef ARRAYBUFFERVIEW_P_H
-#define ARRAYBUFFERVIEW_P_H
-
-#include "../context3d_p.h"
-#include "../abstractobject3d_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasArrayBuffer;
-
-class CanvasArrayBufferView : public CanvasAbstractObject
-{
- Q_OBJECT
- Q_PROPERTY(CanvasArrayBuffer* buffer READ buffer NOTIFY bufferChanged)
- Q_PROPERTY(unsigned long byteOffset READ byteOffset NOTIFY byteOffsetChanged)
- Q_PROPERTY(unsigned long byteLength READ byteLength NOTIFY byteLengthChanged)
-
-public:
- enum canvasArrayBufferTypes {
- ARRAY_BUFFER_UNKNOWN = 0,
- ARRAY_BUFFER_UINT_8,
- ARRAY_BUFFER_UINT_8_CLAMPED,
- ARRAY_BUFFER_UINT_16,
- ARRAY_BUFFER_UINT_32,
- ARRAY_BUFFER_INT_8,
- ARRAY_BUFFER_INT_16,
- ARRAY_BUFFER_INT_32,
- ARRAY_BUFFER_FLOAT_32,
- ARRAY_BUFFER_FLOAT_64
- };
-
- explicit CanvasArrayBufferView(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
- virtual ~CanvasArrayBufferView();
-
- unsigned char* rawDataCptr() const;
-
- CanvasArrayBuffer *buffer();
- unsigned long byteOffset();
- unsigned long byteLength();
- virtual canvasArrayBufferTypes bufferType() = 0;
-
-signals:
- void bufferChanged(CanvasArrayBuffer *buffer);
- void byteOffsetChanged(unsigned long byteLength);
- void byteLengthChanged(unsigned long byteLength);
-
-protected:
- CanvasArrayBuffer *m_buffer;
- unsigned long m_byteOffset;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // ARRAYBUFFERVIEW_P_H
diff --git a/src/typedarray/float32array.cpp b/src/typedarray/float32array.cpp
deleted file mode 100644
index fe83703..0000000
--- a/src/typedarray/float32array.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "float32array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Float32Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of floats.
- *
- * An uncreatable QML type that contains a typed array of floats.
- * Use \l Arrays::newFloat32Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasFloat32Array::CanvasFloat32Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Float32Array(QObject *parent)";
-}
-
-/*!
- * \internal
- */
-CanvasFloat32Array::CanvasFloat32Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- setLength(length);
- //qDebug() << "Float32Array(unsigned long length, QObject *parent)";
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * sizeof(float));
- m_typedBuffer = (float *)m_buffer->m_rawData;
- for (unsigned long i = 0; i < length; i++)
- m_typedBuffer[i] = 0.0;
- }
-}
-
-/*!
- * \internal
- */
-CanvasFloat32Array::CanvasFloat32Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * bytesPerElement());
- m_typedBuffer = (float *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<float>(m_typedBuffer, array, CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- m_buffer = 0;
- m_typedBuffer = 0;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasFloat32Array::CanvasFloat32Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Float32Array(QVariantList *array[" << array->count() << "], parent:"<< parent <<")";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(sizeof(float) * length(), this);
- m_typedBuffer = (float *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<float>()) {
- m_typedBuffer[idx] = element.toFloat();
- } else {
- //qDebug() << "Failed conversion to float of "<<element;
- m_typedBuffer[idx] = 0.f;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasFloat32Array::CanvasFloat32Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Float32Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (float *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod float Float32Array::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-float CanvasFloat32Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return 0.0;
-}
-
-/*!
- * \qmlmethod float Float32Array::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-float CanvasFloat32Array::get(unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return 0.0;
-}
-
-/*!
- * \qmlmethod void Float32Array::set(int index, float value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasFloat32Array::set(unsigned long index, float value)
-{
- if (index < length()) {
- m_typedBuffer[index] = value;
- return;
- }
- qDebug() << "Float32Array " << this << "invalid index " << index;
-}
-
-/*!
- * \qmlmethod void Float32Array::set(TypedArray array, int offset)
- * Copies the \a array to \a offset.
- */
-/*!
- * \internal
- */
-void CanvasFloat32Array::set(CanvasTypedArray *array, unsigned long offset)
-{
- delete m_buffer;
-
- qDebug() << "Float32Array::set( TypedArray" << array << ")";
-
- setLength(array->length() - offset);
- m_buffer = new CanvasArrayBuffer( (length() - offset) * bytesPerElement());
- m_typedBuffer = (float *)m_buffer->m_rawData;
-
- // TODO: ADD OFFSET AS PARAMETER TO COPY TARGET!!!!
- if (!ArrayUtils::copyToTarget<float>(m_typedBuffer, array, length() - offset)) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- m_buffer = 0;
- m_typedBuffer = 0;
- setLength(0);
- }
-}
-
-/*!
- * \qmlmethod void Float32Array::set(list<variant> array, int offset)
- * Copies the \a array to \a offset.
- */
-/*!
- * \internal
- */
-void CanvasFloat32Array::set(QVariantList array, unsigned long offset)
-{
- delete m_buffer;
-
- qDebug() << "Float32Array::set( QVariantList" << array << ")";
-
- setLength(array.count());
- qDebug() << "Float32Array::set(" << array << ")";
- m_buffer = new CanvasArrayBuffer( (length() - offset) * bytesPerElement());
- m_typedBuffer = (float *)m_buffer->m_rawData;
-
- ArrayUtils::fillFloatArrayFromVariantList(array, m_typedBuffer);
-}
-
-
-/*
-void Float32Array::set(float *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Float32Array::subarray(long begin)
-{
-
-}
-
-TypedArray *Float32Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QDebug operator<<(QDebug dbg, const CanvasFloat32Array *array)
-{
- if (array)
- dbg.nospace() << "Float32Array ("<< array->name() <<", length:" << array->length() << ")";
- else
- dbg.nospace() << "Float32Array (null)";
- return dbg.maybeSpace();
-}
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/float32array_p.h b/src/typedarray/float32array_p.h
deleted file mode 100644
index 8d59b5e..0000000
--- a/src/typedarray/float32array_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef FLOAT32ARRAY_P_H
-#define FLOAT32ARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasFloat32Array : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasFloat32Array(QObject *parent = 0);
- explicit CanvasFloat32Array(unsigned long length, QObject *parent = 0);
- explicit CanvasFloat32Array(CanvasTypedArray *array, QObject *parent = 0);
- explicit CanvasFloat32Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasFloat32Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- virtual inline int bytesPerElement() { return sizeof(float); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::FLOAT; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_FLOAT_32; }
-
- Q_INVOKABLE float operator [] (unsigned long index);
- Q_INVOKABLE float get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, float value);
- Q_INVOKABLE void set(QVariantList array, unsigned long offset = 0);
- Q_INVOKABLE void set(CanvasTypedArray *array, unsigned long offset = 0);
- //Q_INVOKABLE void set(float *array, unsigned long offset);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin, long end);
- friend QDebug operator<< (QDebug dbg, const CanvasFloat32Array *array);
-
-private:
- float *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // FLOAT32ARRAY_P_H
diff --git a/src/typedarray/float64array.cpp b/src/typedarray/float64array.cpp
deleted file mode 100644
index 2e59dd8..0000000
--- a/src/typedarray/float64array.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "float64array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Float64Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of doubles.
- *
- * An uncreatable QML type that contains a typed array of doubles.
- * Use \l Arrays::newFloat64Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasFloat64Array::CanvasFloat64Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- setLength(0);
- //qDebug() << "Float64Array(QObject *parent)";
-}
-
-/*!
- * \internal
- */
-CanvasFloat64Array::CanvasFloat64Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Float64Array(unsigned long length, QObject *parent)";
- setLength(length);
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(double) * length);
- m_typedBuffer = (double *)m_buffer->m_rawData;
- for (unsigned long i = 0; i < length; i++) {
- m_typedBuffer[i] = 0.0;
- }
- }
-}
-
-/*!
- * \internal
- */
-CanvasFloat64Array::CanvasFloat64Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (double *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<double>(m_typedBuffer, array, array->length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasFloat64Array::CanvasFloat64Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Float64Array(QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(sizeof(double) * array->count(), this);
- m_typedBuffer = (double *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<double>()) {
- m_typedBuffer[idx] = element.toDouble();
- } else {
- //qDebug() << "Failed conversion to double of "<<element;
- m_typedBuffer[idx] = 0.f;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasFloat64Array::CanvasFloat64Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Float64Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (double *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod double Float64Array::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-double CanvasFloat64Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return 0.0;
-}
-
-/*!
- * \qmlmethod double Float64Array::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-double CanvasFloat64Array::get(unsigned long index)
-{
- return m_typedBuffer[index];
-}
-
-/*!
- * \qmlmethod void Float64Array::set(int index, double value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasFloat64Array::set(unsigned long index, double value)
-{
- m_typedBuffer[index] = value;
-}
-
-/*
-void Float64Array::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Float64Array::set(double *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Float64Array::subarray(long begin)
-{
-
-}
-
-TypedArray *Float64Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/float64array_p.h b/src/typedarray/float64array_p.h
deleted file mode 100644
index 073bc95..0000000
--- a/src/typedarray/float64array_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef FLOAT64ARRAY_P_H
-#define FLOAT64ARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasFloat64Array : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasFloat64Array(QObject *parent = 0);
- explicit CanvasFloat64Array(unsigned long length, QObject *parent = 0);
- explicit CanvasFloat64Array(CanvasTypedArray *array, QObject *parent = 0);
- explicit CanvasFloat64Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasFloat64Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- virtual inline int bytesPerElement() { return sizeof(double); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::NONE; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_FLOAT_64; }
-
- Q_INVOKABLE double operator [] (unsigned long index);
- Q_INVOKABLE double get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, double value);
- //Q_INVOKABLE void set(ArrayBufferView *array, unsigned long offset);
- //Q_INVOKABLE void set(double *array, unsigned long offset);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin, long end);
-
-private:
- double *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // FLOAT64ARRAY_P_H
diff --git a/src/typedarray/int16array.cpp b/src/typedarray/int16array.cpp
deleted file mode 100644
index f24f607..0000000
--- a/src/typedarray/int16array.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "int16array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Int16Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of 16 bit ints.
- *
- * An uncreatable QML type that contains a typed array of 16 bit ints.
- * Use \l Arrays::newInt16Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasInt16Array::CanvasInt16Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Int16Array(QObject *parent)";
- setLength(0);
-}
-
-/*!
- * \internal
- */
-CanvasInt16Array::CanvasInt16Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Int16Array(unsigned long length, QObject *parent)";
- setLength(length);
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(float) * CanvasTypedArray::length());
- m_typedBuffer = (short *)m_buffer->m_rawData;
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt16Array::CanvasInt16Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (short *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<short>(m_typedBuffer, array, CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt16Array::CanvasInt16Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Int16Array(const QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(sizeof(short) * CanvasTypedArray::length(), this);
- m_typedBuffer = (short *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<short>()) {
- m_typedBuffer[idx] = (short)(element.toInt());
- } else {
- //qDebug() << "Failed conversion to unsigned byte of "<<element;
- m_typedBuffer[idx] = (short)0;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt16Array::CanvasInt16Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Int16Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (short *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod int Int16Array::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-short CanvasInt16Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return short(0);
-}
-
-
-/*!
- * \qmlmethod int Int16Array::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-short CanvasInt16Array::get(unsigned long index)
-{
- return m_typedBuffer[index];
-}
-
-/*!
- * \qmlmethod void Int16Array::set(int index, int value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasInt16Array::set(unsigned long index, short value)
-{
- m_typedBuffer[index] = value;
-}
-
-/*
-void Int16Array::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Int16Array::set(float *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Int16Array::subarray(long begin)
-{
-
-}
-
-TypedArray *Int16Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/int16array_p.h b/src/typedarray/int16array_p.h
deleted file mode 100644
index 46283ca..0000000
--- a/src/typedarray/int16array_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef INT16ARRAY_P_H
-#define INT16ARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasInt16Array : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasInt16Array(QObject *parent = 0);
- explicit CanvasInt16Array(unsigned long length, QObject *parent = 0);
- explicit CanvasInt16Array(CanvasTypedArray *array, QObject *parent);
- explicit CanvasInt16Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasInt16Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- Q_INVOKABLE short operator [] (unsigned long index);
- Q_INVOKABLE short get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, short value);
- virtual inline int bytesPerElement() { return sizeof(short); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::SHORT; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_INT_16; }
-
- //Q_INVOKABLE void set(ArrayBufferView *array, unsigned long offset);
- //Q_INVOKABLE void set(short *array, unsigned long offset);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin, long end);
-
-private:
- short *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // INT16ARRAY_P_H
diff --git a/src/typedarray/int32array.cpp b/src/typedarray/int32array.cpp
deleted file mode 100644
index d4213c1..0000000
--- a/src/typedarray/int32array.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "int32array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Int32Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of ints.
- *
- * An uncreatable QML type that contains a typed array of ints.
- * Use \l Arrays::newInt32Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasInt32Array::CanvasInt32Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Int32Array(QObject *parent)";
- setLength(0);
-}
-
-/*!
- * \internal
- */
-CanvasInt32Array::CanvasInt32Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Int32Array(unsigned long length, QObject *parent)";
- setLength(length);
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(float) * CanvasTypedArray::length());
- m_typedBuffer = (int *)m_buffer->m_rawData;
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt32Array::CanvasInt32Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (int *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<int>(m_typedBuffer, array, CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt32Array::CanvasInt32Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Int32Array(const QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(sizeof(int) * CanvasTypedArray::length(), this);
- m_typedBuffer = (int *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<int>()) {
- m_typedBuffer[idx] = (int)(element.toInt());
- } else {
- //qDebug() << "Failed conversion to unsigned byte of "<<element;
- m_typedBuffer[idx] = (int)0;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt32Array::CanvasInt32Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Int32Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (int *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod int Int32Array::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-int CanvasInt32Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return 0;
-}
-
-/*!
- * \qmlmethod int Int32Array::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-int CanvasInt32Array::get(unsigned long index)
-{
- return m_typedBuffer[index];
-}
-
-/*!
- * \qmlmethod void Int32Array::set(int index, int value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasInt32Array::set(unsigned long index, int value)
-{
- m_typedBuffer[index] = value;
-}
-
-/*
-void Int32Array::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Int32Array::set(float *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Int32Array::subarray(long begin)
-{
-
-}
-
-TypedArray *Int32Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/int32array_p.h b/src/typedarray/int32array_p.h
deleted file mode 100644
index 0566215..0000000
--- a/src/typedarray/int32array_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef INT32ARRAY_P_H
-#define INT32ARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasInt32Array : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasInt32Array(QObject *parent = 0);
- explicit CanvasInt32Array(unsigned long length, QObject *parent = 0);
- explicit CanvasInt32Array(CanvasTypedArray *array, QObject *parent);
- explicit CanvasInt32Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasInt32Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- Q_INVOKABLE int operator [] (unsigned long index);
- Q_INVOKABLE int get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, int value);
- virtual inline int bytesPerElement() { return sizeof(int); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::INT; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_INT_32; }
-
- //Q_INVOKABLE void set(TypedArray *array, unsigned long offset);
- //Q_INVOKABLE void set(int *array, unsigned long offset);
- //Q_INVOKABLE TypedArray *subarray(long begin);
- //Q_INVOKABLE TypedArray *subarray(long begin, long end);
-
-private:
- int *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // INT32ARRAY_P_H
diff --git a/src/typedarray/int8array.cpp b/src/typedarray/int8array.cpp
deleted file mode 100644
index 7c9947c..0000000
--- a/src/typedarray/int8array.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "int8array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Int8Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of 8 bit ints.
- *
- * An uncreatable QML type that contains a typed array of 8 bit ints.
- * Use \l Arrays::newInt8Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasInt8Array::CanvasInt8Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Int8Array(QObject *parent)";
- setLength(0);
-}
-
-/*!
- * \internal
- */
-CanvasInt8Array::CanvasInt8Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Int8Array(unsigned long length, QObject *parent)";
- setLength(length);
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(signed char) * CanvasTypedArray::length());
- m_typedBuffer = (signed char *)m_buffer->m_rawData;
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt8Array::CanvasInt8Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (signed char *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<signed char>(m_typedBuffer, array, CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt8Array::CanvasInt8Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Int8Array(const QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * sizeof(signed char), this);
- m_typedBuffer = (signed char *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<signed char>()) {
- m_typedBuffer[idx] = (signed char)(element.toInt());
- } else {
- //qDebug() << "Failed conversion to unsigned byte of "<<element;
- m_typedBuffer[idx] = (signed char)0;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasInt8Array::CanvasInt8Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Int8Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (signed char *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod int Int8Array::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-signed char CanvasInt8Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return char(0);
-}
-
-/*!
- * \qmlmethod int Int8Array::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-signed char CanvasInt8Array::get(unsigned long index)
-{
- return m_typedBuffer[index];
-}
-
-/*!
- * \qmlmethod void Int8Array::set(int index, int value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasInt8Array::set(unsigned long index, signed char value)
-{
- m_typedBuffer[index] = value;
-}
-
-/*
-void Int8Array::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Int8Array::set(float *array, unsigned long offset)
-{
-
-}
-
-Int8Array *Int8Array::subarray(long begin)
-{
-
-}
-
-Int8Array *Int8Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/int8array_p.h b/src/typedarray/int8array_p.h
deleted file mode 100644
index 11e31e3..0000000
--- a/src/typedarray/int8array_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef INT8ARRAY_P_H
-#define INT8ARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasInt8Array : public CanvasTypedArray
-{
- Q_OBJECT
-public:
- explicit CanvasInt8Array(QObject *parent = 0);
- explicit CanvasInt8Array(unsigned long length, QObject *parent = 0);
- explicit CanvasInt8Array(CanvasTypedArray *array, QObject *parent = 0);
- explicit CanvasInt8Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasInt8Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- Q_INVOKABLE signed char operator [] (unsigned long index);
- Q_INVOKABLE signed char get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, signed char value);
- virtual inline int bytesPerElement() { return sizeof(signed char); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::BYTE; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_INT_8; }
-
- //Q_INVOKABLE void set(TypedArray *array, unsigned long offset);
- //Q_INVOKABLE void set(signed char *array, unsigned long offset);
- //Q_INVOKABLE TypedArray *subarray(long begin);
- //Q_INVOKABLE TypedArray *subarray(long begin, long end);
-
-private:
- signed char *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // INT8ARRAY_P_H
diff --git a/src/typedarray/typedarray.cpp b/src/typedarray/typedarray.cpp
deleted file mode 100644
index 3448928..0000000
--- a/src/typedarray/typedarray.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "typedarray_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype TypedArray
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array.
- *
- * An uncreatable QML type that contains a typed array.
- * Use Arrays for creating an array of required type.
- *
- * \sa Arrays, Float32Array, Float64Array, Int8Array, Int16Array, Int32Array, Uint8Array,
- * Uint16Array, Uint32Array, Uint8ClampedArray
- */
-
-/*!
- * \fn virtual inline int CanvasTypedArray::bytesPerElement();
- * \internal
- */
-
-/*!
- * \fn virtual inline CanvasContext3D::glEnums CanvasTypedArray::dataType();
- * \internal
- */
-
-/*!
- * \internal
- */
-CanvasTypedArray::CanvasTypedArray(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent):
- CanvasArrayBufferView(buffer, byteOffset, parent),
- m_length(0)
-{
-}
-
-/*!
- * \internal
- */
-CanvasTypedArray::~CanvasTypedArray()
-{
-}
-
-/*!
- * \qmlmethod int TypedArray::length()
- * Holds the length of the array.
- */
-/*!
- * \internal
- */
-unsigned long CanvasTypedArray::length() const
-{
- return m_length;
-}
-
-/*!
- * \internal
- */
-void CanvasTypedArray::copyFrom(const CanvasArrayBuffer &array)
-{
- m_buffer->copyRawDataFrom(array.m_rawData, array.byteLength());
-}
-
-/*!
- * \internal
- */
-void CanvasTypedArray::setLength(unsigned long length)
-{
- if (length == m_length)
- return;
-
- m_length = length;
- emit lengthChanged(length);
-}
-
-/*!
- * \internal
- */
-QDebug operator<<(QDebug dbg, const CanvasTypedArray *array)
-{
- if (array)
- dbg.nospace() << "TypedArray ("<< array->name() <<", length:" << array->length() << ")";
- else
- dbg.nospace() << "TypedArray (null)";
- return dbg.maybeSpace();
-}
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/typedarray_p.h b/src/typedarray/typedarray_p.h
deleted file mode 100644
index 03ed67a..0000000
--- a/src/typedarray/typedarray_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef TYPEDARRAY_P_H
-#define TYPEDARRAY_P_H
-
-#include "arraybufferview_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasArrayBuffer;
-
-class CanvasTypedArray : public CanvasArrayBufferView
-{
- Q_OBJECT
- Q_PROPERTY(unsigned long length READ length NOTIFY lengthChanged)
-
-public:
- explicit CanvasTypedArray(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
- virtual ~CanvasTypedArray();
-
- void copyFrom(const CanvasArrayBuffer &array);
-
- unsigned long length() const;
- virtual int bytesPerElement() = 0 ;
- virtual CanvasContext::glEnums dataType() = 0;
-
- friend QDebug operator<< (QDebug dbg, const CanvasTypedArray *array);
-
-signals:
- void lengthChanged(unsigned long length);
-
-protected:
- void setLength(unsigned long length);
-
-private:
- unsigned long m_length;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // TYPEDARRAY_P_H
diff --git a/src/typedarray/typedarrayfactory.cpp b/src/typedarray/typedarrayfactory.cpp
deleted file mode 100644
index 7a9f4fe..0000000
--- a/src/typedarray/typedarrayfactory.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "typedarrayfactory_p.h"
-#include "arraybuffer_p.h"
-#include "int8array_p.h"
-#include "uint8array_p.h"
-#include "int16array_p.h"
-#include "uint16array_p.h"
-#include "int32array_p.h"
-#include "uint32array_p.h"
-#include "float32array_p.h"
-#include "float64array_p.h"
-#include "uint8clampedarray_p.h"
-#include "../canvas3dcommon_p.h"
-#include "../teximage3d_p.h"
-
-#include <QDebug>
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Arrays
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Create typed arrays.
- *
- * This QML type can be used for creating typed arrays of required type.
- *
- * \sa Float32Array, Float64Array, Int8Array, Int16Array, Int32Array, Uint8Array,
- * Uint16Array, Uint32Array, Uint8ClampedArray
- */
-
-/*!
- * \internal
- */
-QObject *CanvasTypedArrayFactory::type_array_factory_provider(QQmlEngine *engine,
- QJSEngine *scriptEngine)
-{
- Q_UNUSED(engine)
- Q_UNUSED(scriptEngine)
-
- return new CanvasTypedArrayFactory();
-}
-
-/*!
- * \internal
- */
-CanvasTypedArrayFactory::CanvasTypedArrayFactory(QObject *parent) :
- QObject(parent)
-{
-}
-
-/*!
- * \internal
- */
-CanvasTypedArrayFactory::~CanvasTypedArrayFactory()
-{
-}
-
-/* Typed array creation functions. Typed arrays should be in the V4VM implementation.*/
-
-/*!
- * \qmlmethod Int8Array Arrays::newInt8Array(int length)
- * Returns a new Int8Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasInt8Array *CanvasTypedArrayFactory::newInt8Array(unsigned long length)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<")";
- return new CanvasInt8Array(length);
-}
-
-/*!
- * \qmlmethod Int8Array Arrays::newInt8Array(TypedArray array)
- * Returns a new Int8Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasInt8Array *CanvasTypedArrayFactory::newInt8Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasInt8Array(array);
-}
-
-/*!
- * \qmlmethod Int8Array Arrays::newInt8Array(list<variant> array)
- * Returns a new Int8Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasInt8Array *CanvasTypedArrayFactory::newInt8Array(QVariantList array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return new CanvasInt8Array(&array);
-}
-
-/*!
- * \qmlmethod Int8Array Arrays::newInt8Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Int8Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasInt8Array *CanvasTypedArrayFactory::newInt8Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer buffer, unsigned long byteOffset)";
- return new CanvasInt8Array(buffer, byteOffset);
-}
-
-/*!
- * \qmlmethod Uint8Array Arrays::newUint8Array(int length)
- * Returns a new Uint8Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasUint8Array *CanvasTypedArrayFactory::newUint8Array(unsigned long length)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<")";
- return new CanvasUint8Array(length);
-}
-
-/*!
- * \qmlmethod Uint8Array Arrays::newUint8Array(TypedArray array)
- * Returns a new Uint8Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint8Array *CanvasTypedArrayFactory::newUint8Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasUint8Array(array);
-}
-
-/*!
- * \qmlmethod Uint8Array Arrays::newUint8Array(list<variant> array)
- * Returns a new Uint8Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint8Array *CanvasTypedArrayFactory::newUint8Array(QVariantList array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return new CanvasUint8Array(&array);
-}
-
-/*!
- * \qmlmethod Uint8Array Arrays::newUint8Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Uint8Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasUint8Array *CanvasTypedArrayFactory::newUint8Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer buffer, unsigned long byteOffset)";
- return new CanvasUint8Array(buffer, byteOffset);
-}
-
-/*!
- * \qmlmethod Int16Array Arrays::newInt16Array(int length)
- * Returns a new Int16Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasInt16Array *CanvasTypedArrayFactory::newInt16Array(unsigned long length)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<")";
- return new CanvasInt16Array(length);
-}
-
-/*!
- * \qmlmethod Int16Array Arrays::newInt16Array(TypedArray array)
- * Returns a new Int16Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasInt16Array *CanvasTypedArrayFactory::newInt16Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasInt16Array(array);
-}
-
-/*!
- * \qmlmethod Int16Array Arrays::newInt16Array(list<variant> array)
- * Returns a new Int16Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasInt16Array *CanvasTypedArrayFactory::newInt16Array(QVariantList array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return new CanvasInt16Array(&array);
-}
-
-/*!
- * \qmlmethod Int16Array Arrays::newInt16Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Int16Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasInt16Array *CanvasTypedArrayFactory::newInt16Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer buffer, unsigned long byteOffset)";
- return new CanvasInt16Array(buffer, byteOffset);
-}
-
-/*!
- * \qmlmethod Uint16Array Arrays::newUint16Array(int length)
- * Returns a new Uint16Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasUint16Array *CanvasTypedArrayFactory::newUint16Array(unsigned long length)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<")";
- return new CanvasUint16Array(length);
-}
-
-/*!
- * \qmlmethod Uint16Array Arrays::newUint16Array(TypedArray array)
- * Returns a new Uint16Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint16Array *CanvasTypedArrayFactory::newUint16Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasUint16Array(array);
-}
-
-/*!
- * \qmlmethod Uint16Array Arrays::newUint16Array(list<variant> array)
- * Returns a new Uint16Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint16Array *CanvasTypedArrayFactory::newUint16Array(QVariantList array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return new CanvasUint16Array(&array);
-}
-
-/*!
- * \qmlmethod Uint16Array Arrays::newUint16Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Uint16Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasUint16Array *CanvasTypedArrayFactory::newUint16Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer buffer, unsigned long byteOffset)";
- return new CanvasUint16Array(buffer, byteOffset);
-}
-
-/*!
- * \qmlmethod Int32Array Arrays::newInt32Array(int length)
- * Returns a new Int32Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasInt32Array *CanvasTypedArrayFactory::newInt32Array(unsigned long length)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<")";
- return new CanvasInt32Array(length);
-}
-
-/*!
- * \qmlmethod Int32Array Arrays::newInt32Array(TypedArray array)
- * Returns a new Int32Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasInt32Array *CanvasTypedArrayFactory::newInt32Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasInt32Array(array);
-}
-
-/*!
- * \qmlmethod Int32Array Arrays::newInt32Array(list<variant> array)
- * Returns a new Int32Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasInt32Array *CanvasTypedArrayFactory::newInt32Array(QVariantList array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return new CanvasInt32Array(&array);
-}
-
-/*!
- * \qmlmethod Int32Array Arrays::newInt32Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Int32Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasInt32Array *CanvasTypedArrayFactory::newInt32Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer buffer, unsigned long byteOffset)";
- return new CanvasInt32Array(buffer, byteOffset);
-}
-
-/*!
- * \qmlmethod Uint32Array Arrays::newUint32Array(int length)
- * Returns a new Uint32Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasUint32Array *CanvasTypedArrayFactory::newUint32Array(unsigned long length)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<")";
- return new CanvasUint32Array(length);
-}
-
-/*!
- * \qmlmethod Uint32Array Arrays::newUint32Array(TypedArray array)
- * Returns a new Uint32Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint32Array *CanvasTypedArrayFactory::newUint32Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasUint32Array(array);
-}
-
-/*!
- * \qmlmethod Uint32Array Arrays::newUint32Array(list<variant> array)
- * Returns a new Uint32Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint32Array *CanvasTypedArrayFactory::newUint32Array(QVariantList array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return new CanvasUint32Array(&array);
-}
-
-/*!
- * \qmlmethod Uint32Array Arrays::newUint32Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Uint32Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasUint32Array *CanvasTypedArrayFactory::newUint32Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer buffer, unsigned long byteOffset)";
- return new CanvasUint32Array(buffer, byteOffset);
-}
-
-/*!
- * \qmlmethod Float32Array Arrays::newFloat32Array(int length)
- * Returns a new Float32Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasFloat32Array *CanvasTypedArrayFactory::newFloat32Array(unsigned long length)
-{
- CanvasFloat32Array *newArray = new CanvasFloat32Array(length);
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<"):" << newArray;
- return newArray;
-}
-
-/*!
- * \qmlmethod Float32Array Arrays::newFloat32Array(TypedArray array)
- * Returns a new Float32Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasFloat32Array *CanvasTypedArrayFactory::newFloat32Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasFloat32Array(array);
-}
-
-/*!
- * \qmlmethod Float32Array Arrays::newFloat32Array(list<variant> array)
- * Returns a new Float32Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasFloat32Array *CanvasTypedArrayFactory::newFloat32Array(QVariantList array)
-{
- CanvasFloat32Array *newArray = new CanvasFloat32Array(&array);
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return newArray;
-}
-
-/*!
- * \qmlmethod Float32Array Arrays::newFloat32Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Float32Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasFloat32Array *CanvasTypedArrayFactory::newFloat32Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- CanvasFloat32Array *newArray = new CanvasFloat32Array(buffer, byteOffset);
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer "<<buffer<<", unsigned long "<<byteOffset<<"):"<<newArray;
- return newArray;
-}
-
-/*!
- * \qmlmethod Float64Array Arrays::newFloat64Array(int length)
- * Returns a new Float64Array of \a length.
- */
-/*!
- * \internal
- */
-CanvasFloat64Array *CanvasTypedArrayFactory::newFloat64Array(unsigned long length)
-{
- CanvasFloat64Array *newArray = new CanvasFloat64Array(length);
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<"):" << newArray;
- return newArray;
-}
-
-/*!
- * \qmlmethod Float64Array Arrays::newFloat64Array(TypedArray array)
- * Returns a new Float64Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasFloat64Array *CanvasTypedArrayFactory::newFloat64Array(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasFloat64Array(array);
-}
-
-/*!
- * \qmlmethod Float64Array Arrays::newFloat64Array(list<variant> array)
- * Returns a new Float64Array with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasFloat64Array *CanvasTypedArrayFactory::newFloat64Array(QVariantList array)
-{
- CanvasFloat64Array * newArray = new CanvasFloat64Array(&array);
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return newArray;
-}
-
-/*!
- * \qmlmethod Float64Array Arrays::newFloat64Array(ArrayBuffer buffer, int byteOffset)
- * Returns a new Float64Array with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasFloat64Array *CanvasTypedArrayFactory::newFloat64Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- CanvasFloat64Array *newArray = new CanvasFloat64Array(buffer, byteOffset);
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer "<<buffer<<", unsigned long "<<byteOffset<<"):"<<newArray;
- return newArray;
-}
-
-/*!
- * \qmlmethod Uint8ClampedArray Arrays::newUint8ClampedArray(int length)
- * Returns a new Uint8ClampedArray of \a length.
- */
-/*!
- * \internal
- */
-CanvasUint8ClampedArray *CanvasTypedArrayFactory::newUint8ClampedArray(unsigned long length)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(unsigned long "<<length<<")";
- return new CanvasUint8ClampedArray(length);
-}
-
-/*!
- * \qmlmethod Uint8ClampedArray Arrays::newUint8ClampedArray(TypedArray array)
- * Returns a new Uint8ClampedArray with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint8ClampedArray *CanvasTypedArrayFactory::newUint8ClampedArray(CanvasTypedArray *array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(TypedArray " << array << ")";
- return new CanvasUint8ClampedArray(array);
-}
-
-/*!
- * \qmlmethod Uint8ClampedArray Arrays::newUint8ClampedArray(list<variant> array)
- * Returns a new Uint8ClampedArray with data from \a array.
- */
-/*!
- * \internal
- */
-CanvasUint8ClampedArray *CanvasTypedArrayFactory::newUint8ClampedArray(QVariantList array)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(QVariantList" << array.count() << ")";
- return new CanvasUint8ClampedArray(&array);
-}
-
-/*!
- * \qmlmethod Uint8ClampedArray Arrays::newUint8ClampedArray(ArrayBuffer buffer, int byteOffset)
- * Returns a new Uint8ClampedArray with data from \a buffer starting from \a byteOffset.
- */
-/*!
- * \internal
- */
-CanvasUint8ClampedArray *CanvasTypedArrayFactory::newUint8ClampedArray(CanvasArrayBuffer *buffer,
- unsigned long byteOffset)
-{
- if (VERBOSE_ALL_TYPED_ARRAY_CALLS) qDebug() << "Arrays::" << __FUNCTION__ << "(ArrayBuffer buffer, unsigned long byteOffset)";
- return new CanvasUint8ClampedArray(buffer, byteOffset);
-}
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/typedarrayfactory_p.h b/src/typedarray/typedarrayfactory_p.h
deleted file mode 100644
index e7d7265..0000000
--- a/src/typedarray/typedarrayfactory_p.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef TYPEDARRAYFACTORY_P_H
-#define TYPEDARRAYFACTORY_P_H
-
-#include "../canvas3dcommon_p.h"
-#include <QObject>
-#include <QVariantList>
-#include <QQmlEngine>
-#include <QJSEngine>
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasInt8Array;
-class CanvasUint8Array;
-class CanvasInt16Array;
-class CanvasUint16Array;
-class CanvasInt32Array;
-class CanvasUint32Array;
-class CanvasFloat32Array;
-class CanvasFloat64Array;
-class CanvasUint8ClampedArray;
-class CanvasArrayBuffer;
-class CanvasTypedArray;
-class CanvasTextureImage;
-
-class CanvasTypedArrayFactory : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(CanvasTypedArrayFactory)
-
-public:
- static QObject *type_array_factory_provider(QQmlEngine *engine, QJSEngine *scriptEngine);
-
- explicit CanvasTypedArrayFactory(QObject *parent = 0);
- ~CanvasTypedArrayFactory();
-
- /* Typed array creation functions. Typed arrays should be in the V4VM implementation.*/
- Q_INVOKABLE CanvasInt8Array* newInt8Array(unsigned long length);
- Q_INVOKABLE CanvasInt8Array* newInt8Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasInt8Array* newInt8Array(QVariantList array);
- Q_INVOKABLE CanvasInt8Array* newInt8Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasUint8Array* newUint8Array(unsigned long length);
- Q_INVOKABLE CanvasUint8Array* newUint8Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasUint8Array* newUint8Array(QVariantList array);
- Q_INVOKABLE CanvasUint8Array* newUint8Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasInt16Array* newInt16Array(unsigned long length);
- Q_INVOKABLE CanvasInt16Array* newInt16Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasInt16Array* newInt16Array(QVariantList array);
- Q_INVOKABLE CanvasInt16Array* newInt16Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasUint16Array* newUint16Array(unsigned long length);
- Q_INVOKABLE CanvasUint16Array* newUint16Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasUint16Array* newUint16Array(QVariantList array);
- Q_INVOKABLE CanvasUint16Array* newUint16Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasInt32Array* newInt32Array(unsigned long length);
- Q_INVOKABLE CanvasInt32Array* newInt32Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasInt32Array* newInt32Array(QVariantList array);
- Q_INVOKABLE CanvasInt32Array* newInt32Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasUint32Array* newUint32Array(unsigned long length);
- Q_INVOKABLE CanvasUint32Array* newUint32Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasUint32Array* newUint32Array(QVariantList array);
- Q_INVOKABLE CanvasUint32Array* newUint32Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasFloat32Array* newFloat32Array(unsigned long length);
- Q_INVOKABLE CanvasFloat32Array* newFloat32Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasFloat32Array* newFloat32Array(QVariantList array);
- Q_INVOKABLE CanvasFloat32Array* newFloat32Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasFloat64Array* newFloat64Array(unsigned long length);
- Q_INVOKABLE CanvasFloat64Array* newFloat64Array(CanvasTypedArray *array);
- Q_INVOKABLE CanvasFloat64Array* newFloat64Array(QVariantList array);
- Q_INVOKABLE CanvasFloat64Array* newFloat64Array(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-
- Q_INVOKABLE CanvasUint8ClampedArray* newUint8ClampedArray(unsigned long length);
- Q_INVOKABLE CanvasUint8ClampedArray* newUint8ClampedArray(CanvasTypedArray *array);
- Q_INVOKABLE CanvasUint8ClampedArray* newUint8ClampedArray(QVariantList array);
- Q_INVOKABLE CanvasUint8ClampedArray* newUint8ClampedArray(CanvasArrayBuffer *buffer,
- unsigned long byteOffset);
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // TYPEDARRAYFACTORY_P_H
diff --git a/src/typedarray/uint16array.cpp b/src/typedarray/uint16array.cpp
deleted file mode 100644
index b0a9b28..0000000
--- a/src/typedarray/uint16array.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "uint16array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Uint16Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of 16 bit unsigned ints.
- *
- * An uncreatable QML type that contains a typed array of 16 bit unsigned ints.
- * Use \l Arrays::newUint16Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasUint16Array::CanvasUint16Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Uint16Array(QObject *parent)";
- setLength(0);
-}
-
-/*!
- * \internal
- */
-CanvasUint16Array::CanvasUint16Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Uint16Array(unsigned long length, QObject *parent)";
- setLength(length);
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(float) * CanvasTypedArray::length());
- m_typedBuffer = (unsigned short *)m_buffer->m_rawData;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint16Array::CanvasUint16Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (unsigned short *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<unsigned short>(m_typedBuffer, array,
- CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint16Array::CanvasUint16Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Uint16Array(const QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(sizeof(unsigned short) * CanvasTypedArray::length(), this);
- m_typedBuffer = (unsigned short *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<unsigned short>()) {
- m_typedBuffer[idx] = (unsigned short)(element.toInt());
- } else {
- //qDebug() << "Failed conversion to unsigned byte of "<<element;
- m_typedBuffer[idx] = (unsigned short)0;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint16Array::CanvasUint16Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Uint16Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (unsigned short *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod int Uint16Array::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-unsigned short CanvasUint16Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return ushort(0);
-}
-
-/*!
- * \qmlmethod int Uint16Array::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-unsigned short CanvasUint16Array::get(unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return ushort(0);
-}
-
-/*!
- * \qmlmethod void Uint16Array::set(int index, int value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasUint16Array::set(unsigned long index, unsigned short value)
-{
- if (index < length())
- m_typedBuffer[index] = value;
-}
-
-/*
-void Uint16Array::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Uint16Array::set(float *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Uint16Array::subarray(long begin)
-{
-
-}
-
-TypedArray *Uint16Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/uint16array_p.h b/src/typedarray/uint16array_p.h
deleted file mode 100644
index 107885d..0000000
--- a/src/typedarray/uint16array_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef UINT16ARRAY_P_H
-#define UINT16ARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasUint16Array : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasUint16Array(QObject *parent = 0);
- explicit CanvasUint16Array(unsigned long length, QObject *parent = 0);
- explicit CanvasUint16Array(CanvasTypedArray *array, QObject *parent = 0);
- explicit CanvasUint16Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasUint16Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- Q_INVOKABLE unsigned short operator [] (unsigned long index);
- Q_INVOKABLE unsigned short get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, unsigned short value);
- virtual inline int bytesPerElement() { return sizeof(unsigned short); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::UNSIGNED_SHORT; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_UINT_16; }
-
- //Q_INVOKABLE void set(ArrayBufferView *array, unsigned long offset);
- //Q_INVOKABLE void set(unsigned short *array, unsigned long offset);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin, long end);
-
-private:
- unsigned short *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // UINT16ARRAY_P_H
diff --git a/src/typedarray/uint32array.cpp b/src/typedarray/uint32array.cpp
deleted file mode 100644
index 629ce1f..0000000
--- a/src/typedarray/uint32array.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "uint32array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Uint32Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of unsigned ints.
- *
- * An uncreatable QML type that contains a typed array of unsigned ints.
- * Use \l Arrays::newUint32Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasUint32Array::CanvasUint32Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Uint32Array(QObject *parent)";
- setLength(0);
-}
-
-/*!
- * \internal
- */
-CanvasUint32Array::CanvasUint32Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- //qDebug() << "Uint32Array(unsigned long length, QObject *parent)";
- setLength(length);
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(float) * CanvasTypedArray::length());
- m_typedBuffer = (unsigned int *)m_buffer->m_rawData;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint32Array::CanvasUint32Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (unsigned int *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<unsigned int>(m_typedBuffer, array, CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint32Array::CanvasUint32Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Uint32Array(const QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(sizeof(unsigned int) * CanvasTypedArray::length(), this);
- m_typedBuffer = (unsigned int *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<unsigned int>()) {
- m_typedBuffer[idx] = (unsigned int)(element.toInt());
- } else {
- //qDebug() << "Failed conversion to unsigned byte of "<<element;
- m_typedBuffer[idx] = (unsigned int)0;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint32Array::CanvasUint32Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Uint32Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (unsigned int *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod int Uint32Array::operator [] (int index)
- */
-/*!
- * \internal
- */
-unsigned int CanvasUint32Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return uint(0);
-}
-
-/*!
- * \qmlmethod int Uint32Array::get(int index)
- */
-/*!
- * \internal
- */
-unsigned int CanvasUint32Array::get(unsigned long index)
-{
- return m_typedBuffer[index];
-}
-
-/*!
- * \qmlmethod void Uint32Array::set(int index, int value)
- */
-/*!
- * \internal
- */
-void CanvasUint32Array::set(unsigned long index, unsigned int value)
-{
- m_typedBuffer[index] = value;
-}
-
-/*
-void Uint32Array::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Uint32Array::set(float *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Uint32Array::subarray(long begin)
-{
-
-}
-
-TypedArray *Uint32Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/uint32array_p.h b/src/typedarray/uint32array_p.h
deleted file mode 100644
index 2ddc179..0000000
--- a/src/typedarray/uint32array_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef UINT32ARRAY_P_H
-#define UINT32ARRAY_P_H
-
-#include "typedarray_p.h"
-
-#include <QObject>
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasUint32Array : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasUint32Array(QObject *parent = 0);
- explicit CanvasUint32Array(unsigned long length, QObject *parent = 0);
- explicit CanvasUint32Array(CanvasTypedArray *array, QObject *parent = 0);
- explicit CanvasUint32Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasUint32Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- Q_INVOKABLE unsigned int operator [] (unsigned long index);
- Q_INVOKABLE unsigned int get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, unsigned int value);
- virtual inline int bytesPerElement() { return sizeof(unsigned int); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::UNSIGNED_INT; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_UINT_32; }
-
- //Q_INVOKABLE void set(ArrayBufferView *array, unsigned long offset);
- //Q_INVOKABLE void set(unsigned int *array, unsigned long offset);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin, long end);
-
-private:
- unsigned int *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // UINT32ARRAY_P_H
diff --git a/src/typedarray/uint8array.cpp b/src/typedarray/uint8array.cpp
deleted file mode 100644
index c9fd4c9..0000000
--- a/src/typedarray/uint8array.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "uint8array_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Uint8Array
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of 8 bit unsigned ints.
- *
- * An uncreatable QML type that contains a typed array of 8 bit unsigned ints.
- * Use \l Arrays::newUint8Array() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasUint8Array::CanvasUint8Array(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- setLength(0);
- //qDebug() << "Uint8Array(QObject *parent)";
-}
-
-/*!
- * \internal
- */
-CanvasUint8Array::CanvasUint8Array(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- setLength(length);
- //qDebug() << "Uint8Array(unsigned long length, QObject *parent)";
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(unsigned char) * CanvasTypedArray::length());
- m_typedBuffer = (unsigned char *)m_buffer->m_rawData;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint8Array::CanvasUint8Array(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (unsigned char *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTarget<unsigned char>(m_typedBuffer, array,
- CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint8Array::CanvasUint8Array(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Uint8Array(const QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * sizeof(unsigned char), this);
- m_typedBuffer = (unsigned char *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<unsigned char>()) {
- m_typedBuffer[idx] = (unsigned char)(element.toInt());
- } else {
- //qDebug() << "Failed conversion to unsigned byte of "<<element;
- m_typedBuffer[idx] = (unsigned char)0;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint8Array::CanvasUint8Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Uint8Array(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (unsigned char *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod int Uint8Array::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-unsigned char CanvasUint8Array::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return uchar(0);
-}
-
-/*!
- * \qmlmethod int Uint8Array::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-unsigned char CanvasUint8Array::get(unsigned long index)
-{
- return m_typedBuffer[index];
-}
-
-/*!
- * \qmlmethod void Uint8Array::set(int index, int value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasUint8Array::set(unsigned long index, unsigned char value)
-{
- m_typedBuffer[index] = value;
-}
-
-/*
-void Uint8Array::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Uint8Array::set(float *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Uint8Array::subarray(long begin)
-{
-
-}
-
-TypedArray *Uint8Array::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/uint8array_p.h b/src/typedarray/uint8array_p.h
deleted file mode 100644
index 8ba59ae..0000000
--- a/src/typedarray/uint8array_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef UINT8ARRAY_P_H
-#define UINT8ARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasUint8Array : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasUint8Array(QObject *parent = 0);
- explicit CanvasUint8Array(unsigned long length, QObject *parent = 0);
- explicit CanvasUint8Array(QVariantList *array, QObject *parent = 0);
- explicit CanvasUint8Array(CanvasTypedArray *array, QObject *parent = 0);
- explicit CanvasUint8Array(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- Q_INVOKABLE unsigned char operator [] (unsigned long index);
- Q_INVOKABLE unsigned char get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, unsigned char value);
- virtual inline int bytesPerElement() { return sizeof(unsigned char); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::UNSIGNED_BYTE; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_UINT_8; }
-
- //Q_INVOKABLE void set(ArrayBufferView *array, unsigned long offset);
- //Q_INVOKABLE void set(unsigned char *array, unsigned long offset);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin, long end);
-
-private:
- unsigned char *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // UINT8ARRAY_P_H
diff --git a/src/typedarray/uint8clampedarray.cpp b/src/typedarray/uint8clampedarray.cpp
deleted file mode 100644
index cec2c3a..0000000
--- a/src/typedarray/uint8clampedarray.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "uint8clampedarray_p.h"
-#include "../arrayutils_p.h"
-#include "arraybuffer_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-/*!
- * \qmltype Uint8ClampedArray
- * \since QtCanvas3D 1.0
- * \ingroup qtcanvas3d-qml-types
- * \brief Contains a typed array of clamped 8 bit unsigned ints.
- *
- * An uncreatable QML type that contains a typed array of clamped 8 bit unsigned ints.
- * Use \l Arrays::newUint8ClampedArray() for getting an array of this type.
- */
-
-/*!
- * \internal
- */
-CanvasUint8ClampedArray::CanvasUint8ClampedArray(QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- setLength(0);
- //qDebug() << "Uint8ClampedArray(QObject *parent)";
-}
-
-/*!
- * \internal
- */
-CanvasUint8ClampedArray::CanvasUint8ClampedArray(unsigned long length, QObject *parent) :
- CanvasTypedArray(0, 0, parent),
- m_typedBuffer(0)
-{
- setLength(length);
- //qDebug() << "Uint8ClampedArray(unsigned long length, QObject *parent)";
- if (length > 0) {
- m_buffer = new CanvasArrayBuffer(sizeof(unsigned char) * CanvasTypedArray::length());
- m_typedBuffer = (unsigned char *)m_buffer->m_rawData;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint8ClampedArray::CanvasUint8ClampedArray(CanvasTypedArray *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- setLength(array->length());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * this->bytesPerElement());
- m_typedBuffer = (unsigned char *)m_buffer->m_rawData;
-
- if (!ArrayUtils::copyToTargetClampedByte(m_typedBuffer, array, CanvasTypedArray::length())) {
- // Conversion failed, make this an empty buffer
- delete m_buffer;
- setLength(0);
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint8ClampedArray::CanvasUint8ClampedArray(QVariantList *array, QObject *parent) :
- CanvasTypedArray(0, 0, parent)
-{
- //qDebug() << "Uint8ClampedArray(const QVariantList *array[" << array->count() << "], QObject *parent)";
- setLength(array->count());
- m_buffer = new CanvasArrayBuffer(CanvasTypedArray::length() * sizeof(unsigned char), this);
- m_typedBuffer = (unsigned char *)m_buffer->m_rawData;
- int idx = 0;
- for (QVariantList::const_iterator it = array->begin(); it != array->end(); ++it) {
- QVariant element = *it;
- if (element.canConvert<unsigned char>()) {
- m_typedBuffer[idx] = (unsigned char)(element.toInt());
- } else {
- //qDebug() << "Failed conversion to unsigned byte of "<<element;
- m_typedBuffer[idx] = (unsigned char)0;
- }
- idx++;
- }
-}
-
-/*!
- * \internal
- */
-CanvasUint8ClampedArray::CanvasUint8ClampedArray(CanvasArrayBuffer *buffer,
- unsigned long byteOffset, QObject *parent) :
- CanvasTypedArray(buffer, byteOffset, parent)
-{
- //qDebug() << "Uint8ClampedArray(ArrayBuffer *buffer, unsigned long byteOffset, QObject *parent)";
- m_typedBuffer = (unsigned char *)(m_buffer->m_rawData + byteOffset);
- setLength((byteLength() - byteOffset) / bytesPerElement());
-}
-
-/*!
- * \qmlmethod int Uint8ClampedArray::operator [] (int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-unsigned char CanvasUint8ClampedArray::operator [] (unsigned long index)
-{
- if (index < length())
- return m_typedBuffer[index];
- return uchar(0);
-}
-
-/*!
- * \qmlmethod int Uint8ClampedArray::get(int index)
- * Returns the array value at \a index.
- */
-/*!
- * \internal
- */
-unsigned char CanvasUint8ClampedArray::get(unsigned long index)
-{
- return m_typedBuffer[index];
-}
-
-/*!
- * \qmlmethod void Uint8ClampedArray::set(int index, int value)
- * Sets the \a value to \a index in the array.
- */
-/*!
- * \internal
- */
-void CanvasUint8ClampedArray::set(unsigned long index, unsigned char value)
-{
- m_typedBuffer[index] = value;
-}
-
-/*
-void Uint8ClampedArray::set(TypedArray *array, unsigned long offset)
-{
-
-}
-
-void Uint8ClampedArray::set(float *array, unsigned long offset)
-{
-
-}
-
-TypedArray *Uint8ClampedArray::subarray(long begin)
-{
-
-}
-
-TypedArray *Uint8ClampedArray::subarray(long begin, long end)
-{
-
-}
-*/
-
-QT_CANVAS3D_END_NAMESPACE
diff --git a/src/typedarray/uint8clampedarray_p.h b/src/typedarray/uint8clampedarray_p.h
deleted file mode 100644
index 1d01c4d..0000000
--- a/src/typedarray/uint8clampedarray_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCanvas3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the QtCanvas3D API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef UINT8CLAMPEDARRAY_P_H
-#define UINT8CLAMPEDARRAY_P_H
-
-#include "typedarray_p.h"
-
-QT_CANVAS3D_BEGIN_NAMESPACE
-
-class CanvasUint8ClampedArray : public CanvasTypedArray
-{
- Q_OBJECT
-
-public:
- explicit CanvasUint8ClampedArray(QObject *parent = 0);
- explicit CanvasUint8ClampedArray(unsigned long length, QObject *parent = 0);
- explicit CanvasUint8ClampedArray(QVariantList *array, QObject *parent = 0);
- explicit CanvasUint8ClampedArray(CanvasTypedArray *array, QObject *parent = 0);
- explicit CanvasUint8ClampedArray(CanvasArrayBuffer *buffer, unsigned long byteOffset,
- QObject *parent = 0);
-
- Q_INVOKABLE unsigned char operator [] (unsigned long index);
- Q_INVOKABLE unsigned char get(unsigned long index);
- Q_INVOKABLE void set(unsigned long index, unsigned char value);
- virtual inline int bytesPerElement() { return sizeof(unsigned char); }
- virtual inline CanvasContext::glEnums dataType() { return CanvasContext::UNSIGNED_BYTE; }
- virtual inline canvasArrayBufferTypes bufferType() { return CanvasArrayBufferView::ARRAY_BUFFER_UINT_8_CLAMPED; }
- //Q_INVOKABLE void set(ArrayBufferView *array, unsigned long offset);
- //Q_INVOKABLE void set(unsigned char *array, unsigned long offset);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin);
- //Q_INVOKABLE ArrayBufferView *subarray(long begin, long end);
-
-private:
- unsigned char *m_typedBuffer;
-};
-
-QT_CANVAS3D_END_NAMESPACE
-
-#endif // UINT8CLAMPEDARRAY_P_H
diff --git a/src/uniformlocation.cpp b/src/uniformlocation.cpp
index 2b49ed1..456ca00 100644
--- a/src/uniformlocation.cpp
+++ b/src/uniformlocation.cpp
@@ -36,6 +36,7 @@
#include "uniformlocation_p.h"
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
/*!
@@ -86,3 +87,4 @@ QDebug operator<<(QDebug dbg, const CanvasUniformLocation *uLoc)
}
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/uniformlocation_p.h b/src/uniformlocation_p.h
index db5e8c5..b276d04 100644
--- a/src/uniformlocation_p.h
+++ b/src/uniformlocation_p.h
@@ -51,6 +51,7 @@
#include <QDebug>
+QT_BEGIN_NAMESPACE
QT_CANVAS3D_BEGIN_NAMESPACE
class CanvasUniformLocation : public CanvasAbstractObject
@@ -70,5 +71,6 @@ private:
};
QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
#endif // UNIFORMLOCATION_P_H
diff --git a/sync.profile b/sync.profile
index 6c7b1d5..133eb08 100644
--- a/sync.profile
+++ b/sync.profile
@@ -10,6 +10,6 @@
# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
#
%dependencies = (
- "qtbase" => "refs/heads/stable",
- "qtdeclarative" => "refs/heads/stable",
+ "qtbase" => "",
+ "qtdeclarative" => "",
);