summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java60
-rw-r--r--libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs6
-rw-r--r--libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs7
-rw-r--r--libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh35
-rw-r--r--libs/rs/rsElement.cpp9
5 files changed, 19 insertions, 98 deletions
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java
index e70e811..8351f42 100644
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java
+++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SgTransform.java
@@ -46,9 +46,6 @@ public class SgTransform {
ScriptField_SgTransform mChildField;
public ScriptField_SgTransform.Item mTransformData;
- Float4[] mTransforms;
- TransformType[] mTransformTypes;
-
RenderScript mRS;
Vector mChildren;
@@ -66,62 +63,20 @@ public class SgTransform {
}
public void setTransform(int index, Float4 value, TransformType type) {
- mTransforms[index] = value;
- mTransformTypes[index] = type;
+ mTransformData.transforms[index] = value;
+ mTransformData.transformTypes[index] = type.mID;
}
void initData() {
- int numTransforms = 16;
- mTransforms = new Float4[numTransforms];
- mTransformTypes = new TransformType[numTransforms];
- for(int i = 0; i < numTransforms; i ++) {
- mTransforms[i] = new Float4(0, 0, 0, 0);
- mTransformTypes[i] = TransformType.NONE;
+ int numElements = mTransformData.transforms.length;
+ mTransformData.transformTypes = new int[numElements];
+ for(int i = 0; i < numElements; i ++) {
+ mTransformData.transforms[i] = new Float4(0, 0, 0, 0);
+ mTransformData.transformTypes[i] = TransformType.NONE.mID;
}
- }
-
- void setData() {
-
- mTransformData.globalMat = new Matrix4f();
- mTransformData.localMat = new Matrix4f();
-
- mTransformData.transforms0 = mTransforms[0];
- mTransformData.transforms1 = mTransforms[1];
- mTransformData.transforms2 = mTransforms[2];
- mTransformData.transforms3 = mTransforms[3];
- mTransformData.transforms4 = mTransforms[4];
- mTransformData.transforms5 = mTransforms[5];
- mTransformData.transforms6 = mTransforms[6];
- mTransformData.transforms7 = mTransforms[7];
- mTransformData.transforms8 = mTransforms[8];
- mTransformData.transforms9 = mTransforms[9];
- mTransformData.transforms10 = mTransforms[10];
- mTransformData.transforms11 = mTransforms[11];
- mTransformData.transforms12 = mTransforms[12];
- mTransformData.transforms13 = mTransforms[13];
- mTransformData.transforms14 = mTransforms[14];
- mTransformData.transforms15 = mTransforms[15];
-
- mTransformData.transformType0 = mTransformTypes[0].mID;
- mTransformData.transformType1 = mTransformTypes[1].mID;
- mTransformData.transformType2 = mTransformTypes[2].mID;
- mTransformData.transformType3 = mTransformTypes[3].mID;
- mTransformData.transformType4 = mTransformTypes[4].mID;
- mTransformData.transformType5 = mTransformTypes[5].mID;
- mTransformData.transformType6 = mTransformTypes[6].mID;
- mTransformData.transformType7 = mTransformTypes[7].mID;
- mTransformData.transformType8 = mTransformTypes[8].mID;
- mTransformData.transformType9 = mTransformTypes[9].mID;
- mTransformData.transformType10 = mTransformTypes[10].mID;
- mTransformData.transformType11 = mTransformTypes[11].mID;
- mTransformData.transformType12 = mTransformTypes[12].mID;
- mTransformData.transformType13 = mTransformTypes[13].mID;
- mTransformData.transformType14 = mTransformTypes[14].mID;
- mTransformData.transformType15 = mTransformTypes[15].mID;
mTransformData.isDirty = 1;
mTransformData.children = null;
-
}
public SgTransform(RenderScript rs) {
@@ -132,7 +87,6 @@ public class SgTransform {
}
public ScriptField_SgTransform.Item getData() {
- setData();
if(mChildren.size() != 0) {
mChildField = new ScriptField_SgTransform(mRS, mChildren.size());
mTransformData.children = mChildField.getAllocation();
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs b/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs
index 66315aa..3bee8d6 100644
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs
+++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs
@@ -48,16 +48,16 @@ void init() {
int root(int launchID) {
- gGroup->transforms1.w += 0.5f;
+ gGroup->transforms[1].w += 0.5f;
gGroup->isDirty = 1;
SgTransform *robot1Ptr = gRobot1 + gRobot1Index;
- robot1Ptr->transforms1.w -= 1.5f;
+ robot1Ptr->transforms[1].w -= 1.5f;
robot1Ptr->isDirty = 1;
SgTransform *robot2Ptr = gRobot2 + gRobot2Index;
- robot2Ptr->transforms1.w += 2.5f;
+ robot2Ptr->transforms[1].w += 2.5f;
robot2Ptr->isDirty = 1;
rsForEach(gTransformRS, gRootNode->children, gRootNode->children, 0);
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs b/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs
index a7f5ee8..e7c04de 100644
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs
+++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform.rs
@@ -67,15 +67,12 @@ void root(const void *v_in, void *v_out, const void *usrData, uint32_t x, uint32
// Reset our local matrix
rsMatrixLoadIdentity(localMat);
- float4 *transformSource = &data->transforms0;
- int *transformTypes = &data->transformType0;
-
for(int i = 0; i < 16; i ++) {
- if(transformTypes[i] == TRANSFORM_NONE) {
+ if(data->transformTypes[i] == TRANSFORM_NONE) {
break;
}
//rsDebug("Transform adding transformation", transformTypes[i]);
- appendTransformation(transformTypes[i], transformSource[i], localMat);
+ appendTransformation(data->transformTypes[i], data->transforms[i], localMat);
}
}
diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh b/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh
index a99bac2..7d1721c 100644
--- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh
+++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/transform_def.rsh
@@ -25,39 +25,8 @@ typedef struct __attribute__((packed, aligned(4))) {
rs_matrix4x4 globalMat;
rs_matrix4x4 localMat;
- float4 transforms0;
- float4 transforms1;
- float4 transforms2;
- float4 transforms3;
- float4 transforms4;
- float4 transforms5;
- float4 transforms6;
- float4 transforms7;
- float4 transforms8;
- float4 transforms9;
- float4 transforms10;
- float4 transforms11;
- float4 transforms12;
- float4 transforms13;
- float4 transforms14;
- float4 transforms15;
-
- int transformType0;
- int transformType1;
- int transformType2;
- int transformType3;
- int transformType4;
- int transformType5;
- int transformType6;
- int transformType7;
- int transformType8;
- int transformType9;
- int transformType10;
- int transformType11;
- int transformType12;
- int transformType13;
- int transformType14;
- int transformType15;
+ float4 transforms[16];
+ int transformTypes[16];
int isDirty;
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 2becab0..9e6fbd5 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -73,11 +73,12 @@ size_t Element::getSizeBits() const
void Element::dumpLOGV(const char *prefix) const
{
ObjectBase::dumpLOGV(prefix);
- LOGV("%s Element: components %i, size %i", prefix, mFieldCount, mBits);
+ LOGV("%s Element: fieldCount: %i, size bytes: %i", prefix, mFieldCount, getSizeBytes());
for (uint32_t ct = 0; ct < mFieldCount; ct++) {
- char buf[1024];
- sprintf(buf, "%s component %i: ", prefix, ct);
- //mComponents[ct]->dumpLOGV(buf);
+ LOGV("%s Element field index: %u ------------------", prefix, ct);
+ LOGV("%s name: %s, offsetBits: %u, arraySize: %u",
+ prefix, mFields[ct].name.string(), mFields[ct].offsetBits, mFields[ct].arraySize);
+ mFields[ct].e->dumpLOGV(prefix);
}
}