Rename some elements to be more in line with rest of framework.
Change-Id: Icb007bafca9c76959eee2e8134b1d7c592ca885c
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/ColladaParser.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/ColladaParser.java
index c7caf8d..8a141fe 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/ColladaParser.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/ColladaParser.java
@@ -147,11 +147,11 @@
}
}
- private void getDrawable(Element shape, Transform t) {
+ private void getRenderable(Element shape, Transform t) {
String geoURL = shape.getAttribute("url");
- //DrawableGroup group = new DrawableGroup();
+ //RenderableGroup group = new RenderableGroup();
//group.setName(geoURL.substring(1));
- //mScene.appendDrawable(group);
+ //mScene.appendRenderable(group);
NodeList nl = shape.getElementsByTagName("instance_material");
if (nl != null) {
for(int i = 0; i < nl.getLength(); i++) {
@@ -159,7 +159,7 @@
String meshIndexName = materialRef.getAttribute("symbol");
String materialName = materialRef.getAttribute("target");
- Drawable d = new Drawable();
+ Renderable d = new Renderable();
d.setMesh(geoURL.substring(1), meshIndexName);
d.setMaterialName(materialName);
d.setName(geoURL.substring(1));
@@ -180,7 +180,7 @@
d.appendSourceParams(materialParams.get(pI));
//Log.v(TAG, "Set source param i: " + pI + " name " + materialParams.get(pI).getParamName());
}
- mScene.appendDrawable(d);
+ mScene.appendRenderable(d);
//group.appendChildren(d);
}
}
@@ -244,7 +244,7 @@
//Log.v(TAG, indent + " scale " + description + toString(value));
current.addComponent(new ScaleComponent(description, value));
} else if (fieldName.equals("instance_geometry")) {
- getDrawable(field, current);
+ getRenderable(field, current);
} else if (fieldName.equals("instance_light")) {
updateLight(field, current);
} else if (fieldName.equals("instance_camera")) {
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java
index 049083b..0026872 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java
@@ -81,8 +81,8 @@
Allocation.USAGE_GRAPHICS_RENDER_TARGET);
}
- private static Drawable getDrawableQuad(String name, RenderState state, SceneManager sceneManager) {
- Drawable quad = new Drawable();
+ private static Renderable getRenderableQuad(String name, RenderState state, SceneManager sceneManager) {
+ Renderable quad = new Renderable();
quad.setTransform(new MatrixTransform());
quad.setMesh(sceneManager.getScreenAlignedQuad());
quad.setName(name);
@@ -92,7 +92,7 @@
}
static void addBlurPasses(Scene scene, RenderScriptGL rs, SceneManager sceneManager) {
- ArrayList<DrawableBase> allDraw = scene.getDrawables();
+ ArrayList<RenderableBase> allDraw = scene.getRenderables();
int numDraw = allDraw.size();
RenderState drawTex = new RenderState(mPV_Blur, mPF_Texture,
@@ -120,7 +120,7 @@
blurSourcePass.setShouldClearDepth(true);
blurSourcePass.setCamera(scene.getCameras().get(1));
for (int i = 0; i < numDraw; i ++) {
- blurSourcePass.appendDrawable((Drawable)allDraw.get(i));
+ blurSourcePass.appendRenderable((Renderable)allDraw.get(i));
}
scene.appendRenderPass(blurSourcePass);
@@ -131,9 +131,9 @@
selectColorPass.setShouldClearDepth(false);
selectColorPass.setCamera(scene.getCameras().get(1));
// Make blur shape
- Drawable quad = getDrawableQuad("ScreenAlignedQuadS", selectCol, sceneManager);
+ Renderable quad = getRenderableQuad("ScreenAlignedQuadS", selectCol, sceneManager);
quad.updateTextures(rs, sRenderTargetBlur0Color, 0);
- selectColorPass.appendDrawable(quad);
+ selectColorPass.appendRenderable(quad);
scene.appendRenderPass(selectColorPass);
RenderPass horizontalBlurPass = new RenderPass();
@@ -143,9 +143,9 @@
horizontalBlurPass.setShouldClearDepth(false);
horizontalBlurPass.setCamera(scene.getCameras().get(1));
// Make blur shape
- quad = getDrawableQuad("ScreenAlignedQuadH", hBlur, sceneManager);
+ quad = getRenderableQuad("ScreenAlignedQuadH", hBlur, sceneManager);
quad.updateTextures(rs, sRenderTargetBlur2Color, 0);
- horizontalBlurPass.appendDrawable(quad);
+ horizontalBlurPass.appendRenderable(quad);
scene.appendRenderPass(horizontalBlurPass);
RenderPass verticalBlurPass = new RenderPass();
@@ -155,9 +155,9 @@
verticalBlurPass.setShouldClearDepth(false);
verticalBlurPass.setCamera(scene.getCameras().get(1));
// Make blur shape
- quad = getDrawableQuad("ScreenAlignedQuadV", vBlur, sceneManager);
+ quad = getRenderableQuad("ScreenAlignedQuadV", vBlur, sceneManager);
quad.updateTextures(rs, sRenderTargetBlur1Color, 0);
- verticalBlurPass.appendDrawable(quad);
+ verticalBlurPass.appendRenderable(quad);
scene.appendRenderPass(verticalBlurPass);
}
@@ -173,9 +173,9 @@
compositePass.setClearDepth(1.0f);
compositePass.setShouldClearDepth(false);
compositePass.setCamera(scene.getCameras().get(1));
- Drawable quad = getDrawableQuad("ScreenAlignedQuad", drawTex, sceneManager);
+ Renderable quad = getRenderableQuad("ScreenAlignedQuad", drawTex, sceneManager);
quad.updateTextures(rs, sRenderTargetBlur2Color, 0);
- compositePass.appendDrawable(quad);
+ compositePass.appendRenderable(quad);
scene.appendRenderPass(compositePass);
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java
index 0012b10..6ba0637 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java
@@ -37,21 +37,21 @@
float mClearDepth;
boolean mShouldClearDepth;
- ArrayList<DrawableBase> mObjectsToDraw;
+ ArrayList<RenderableBase> mObjectsToDraw;
Camera mCamera;
ScriptField_RenderPass_s.Item mRsField;
public RenderPass() {
- mObjectsToDraw = new ArrayList<DrawableBase>();
+ mObjectsToDraw = new ArrayList<RenderableBase>();
mClearColor = new Float4(0.0f, 0.0f, 0.0f, 0.0f);
mShouldClearColor = true;
mClearDepth = 1.0f;
mShouldClearDepth = true;
}
- public void appendDrawable(Drawable d) {
+ public void appendRenderable(Renderable d) {
mObjectsToDraw.add(d);
}
@@ -95,7 +95,7 @@
mObjectsToDraw.size());
Allocation[] drawableAllocs = new Allocation[mObjectsToDraw.size()];
for (int i = 0; i < mObjectsToDraw.size(); i ++) {
- Drawable dI = (Drawable)mObjectsToDraw.get(i);
+ Renderable dI = (Renderable)mObjectsToDraw.get(i);
drawableAllocs[i] = dI.getRsField(rs, res).getAllocation();
}
drawableData.copyFrom(drawableAllocs);
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Drawable.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
similarity index 92%
rename from tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Drawable.java
rename to tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
index 2eaca13..dbbb1ba 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Drawable.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
@@ -33,7 +33,7 @@
/**
* @hide
*/
-public class Drawable extends DrawableBase {
+public class Renderable extends RenderableBase {
Allocation mVertexParams;
Allocation mFragmentParams;
ArrayList<Allocation> mFragmentTextures;
@@ -57,10 +57,10 @@
// quick hack to prototype
int sceneIndex;
- ScriptField_Drawable_s mRsField;
- ScriptField_Drawable_s.Item mRsFieldItem;
+ ScriptField_Renderable_s mRsField;
+ ScriptField_Renderable_s.Item mRsFieldItem;
- public Drawable() {
+ public Renderable() {
mSourceParams = new ArrayList<ShaderParam>();
}
@@ -140,13 +140,13 @@
mRsField.set(mRsFieldItem, 0, true);
}
- ScriptField_Drawable_s getRsField(RenderScriptGL rs, Resources res) {
+ ScriptField_Renderable_s getRsField(RenderScriptGL rs, Resources res) {
if (mRsField != null) {
return mRsField;
}
getRsFieldItem(rs, res);
- mRsField = new ScriptField_Drawable_s(rs, 1);
+ mRsField = new ScriptField_Renderable_s(rs, 1);
mRsField.set(mRsFieldItem, 0, true);
return mRsField;
@@ -157,7 +157,7 @@
return;
}
- mRsFieldItem = new ScriptField_Drawable_s.Item();
+ mRsFieldItem = new ScriptField_Renderable_s.Item();
mRsFieldItem.mesh = mMesh;
mRsFieldItem.meshIndex = mMeshIndex;
mRsFieldItem.pv_const = mVertexParams;
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/DrawableBase.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderableBase.java
similarity index 91%
rename from tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/DrawableBase.java
rename to tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderableBase.java
index 113ccd4..74535dd 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/DrawableBase.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderableBase.java
@@ -28,8 +28,8 @@
/**
* @hide
*/
-public class DrawableBase extends SceneGraphBase {
- public DrawableBase() {
+public class RenderableBase extends SceneGraphBase {
+ public RenderableBase() {
}
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/DrawableGroup.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderableGroup.java
similarity index 80%
rename from tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/DrawableGroup.java
rename to tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderableGroup.java
index ac44f0b..590bbab 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/DrawableGroup.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderableGroup.java
@@ -28,15 +28,15 @@
/**
* @hide
*/
-public class DrawableGroup extends DrawableBase {
+public class RenderableGroup extends RenderableBase {
- ArrayList<DrawableBase> mChildren;
+ ArrayList<RenderableBase> mChildren;
- public DrawableGroup() {
- mChildren = new ArrayList<DrawableBase>();
+ public RenderableGroup() {
+ mChildren = new ArrayList<RenderableBase>();
}
- public void appendChildren(DrawableBase d) {
+ public void appendChildren(RenderableBase d) {
mChildren.add(d);
}
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java
index b1ae365..cb1ad8b 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java
@@ -38,8 +38,8 @@
private class ImageLoaderTask extends AsyncTask<String, Void, Boolean> {
protected Boolean doInBackground(String... names) {
long start = System.currentTimeMillis();
- for (int i = 0; i < mDrawables.size(); i ++) {
- Drawable dI = (Drawable)mDrawables.get(i);
+ for (int i = 0; i < mRenderables.size(); i ++) {
+ Renderable dI = (Renderable)mRenderables.get(i);
dI.updateTextures(mRS, mRes);
}
long end = System.currentTimeMillis();
@@ -56,11 +56,11 @@
ArrayList<RenderPass> mRenderPasses;
ArrayList<LightBase> mLights;
ArrayList<Camera> mCameras;
- ArrayList<DrawableBase> mDrawables;
- HashMap<String, DrawableBase> mDrawableMap;
+ ArrayList<RenderableBase> mRenderables;
+ HashMap<String, RenderableBase> mRenderableMap;
ArrayList<Texture2D> mTextures;
- HashMap<String, ArrayList<Drawable> > mDrawableMeshMap;
+ HashMap<String, ArrayList<Renderable> > mRenderableMeshMap;
// RS Specific stuff
ScriptField_SgTransform mTransformRSData;
@@ -74,9 +74,9 @@
mRenderPasses = new ArrayList<RenderPass>();
mLights = new ArrayList<LightBase>();
mCameras = new ArrayList<Camera>();
- mDrawables = new ArrayList<DrawableBase>();
- mDrawableMap = new HashMap<String, DrawableBase>();
- mDrawableMeshMap = new HashMap<String, ArrayList<Drawable> >();
+ mRenderables = new ArrayList<RenderableBase>();
+ mRenderableMap = new HashMap<String, RenderableBase>();
+ mRenderableMeshMap = new HashMap<String, ArrayList<Renderable> >();
mTextures = new ArrayList<Texture2D>();
mRootTransforms = new CompoundTransform();
mRootTransforms.setName("_scene_root_");
@@ -116,17 +116,17 @@
return mCameras;
}
- public void appendDrawable(DrawableBase d) {
- mDrawables.add(d);
- mDrawableMap.put(d.getName(), d);
+ public void appendRenderable(RenderableBase d) {
+ mRenderables.add(d);
+ mRenderableMap.put(d.getName(), d);
}
- public ArrayList<DrawableBase> getDrawables() {
- return mDrawables;
+ public ArrayList<RenderableBase> getRenderables() {
+ return mRenderables;
}
- public DrawableBase getDrawableByName(String name) {
- return mDrawableMap.get(name);
+ public RenderableBase getRenderableByName(String name) {
+ return mRenderableMap.get(name);
}
public void appendTextures(Texture2D tex) {
@@ -135,9 +135,9 @@
public void assignRenderStateToMaterial(RenderState renderState, String regex) {
Pattern pattern = Pattern.compile(regex);
- int numDrawables = mDrawables.size();
- for (int i = 0; i < numDrawables; i ++) {
- Drawable shape = (Drawable)mDrawables.get(i);
+ int numRenderables = mRenderables.size();
+ for (int i = 0; i < numRenderables; i ++) {
+ Renderable shape = (Renderable)mRenderables.get(i);
Matcher m = pattern.matcher(shape.mMaterialName);
if (m.find()) {
shape.setRenderState(renderState);
@@ -146,28 +146,28 @@
}
public void assignRenderState(RenderState renderState) {
- int numDrawables = mDrawables.size();
- for (int i = 0; i < numDrawables; i ++) {
- Drawable shape = (Drawable)mDrawables.get(i);
+ int numRenderables = mRenderables.size();
+ for (int i = 0; i < numRenderables; i ++) {
+ Renderable shape = (Renderable)mRenderables.get(i);
shape.setRenderState(renderState);
}
}
public void meshLoaded(Mesh m) {
- ArrayList<Drawable> entries = mDrawableMeshMap.get(m.getName());
+ ArrayList<Renderable> entries = mRenderableMeshMap.get(m.getName());
int numEntries = entries.size();
for (int i = 0; i < numEntries; i++) {
- Drawable d = entries.get(i);
+ Renderable d = entries.get(i);
d.resolveMeshData(m);
- //mDrawablesField.set(d.getRsField(mRS, mRes), d.sceneIndex, true);
+ //mRenderablesField.set(d.getRsField(mRS, mRes), d.sceneIndex, true);
}
}
- void addToMeshMap(Drawable d) {
- ArrayList<Drawable> entries = mDrawableMeshMap.get(d.mMeshName);
+ void addToMeshMap(Renderable d) {
+ ArrayList<Renderable> entries = mRenderableMeshMap.get(d.mMeshName);
if (entries == null) {
- entries = new ArrayList<Drawable>();
- mDrawableMeshMap.put(d.mMeshName, entries);
+ entries = new ArrayList<Renderable>();
+ mRenderableMeshMap.put(d.mMeshName, entries);
}
entries.add(d);
}
@@ -175,7 +175,7 @@
public void destroyRS(SceneManager sceneManager) {
mTransformRSData = null;
sceneManager.mRenderLoop.bind_gRootNode(mTransformRSData);
- sceneManager.mRenderLoop.set_gDrawableObjects(null);
+ sceneManager.mRenderLoop.set_gRenderableObjects(null);
mRenderPassAlloc = null;
sceneManager.mRenderLoop.set_gRenderPasses(null);
sceneManager.mRenderLoop.bind_gFrontToBack(null);
@@ -186,10 +186,10 @@
mRenderPasses = null;
mLights = null;
mCameras = null;
- mDrawables = null;
- mDrawableMap = null;
+ mRenderables = null;
+ mRenderableMap = null;
mTextures = null;
- mDrawableMeshMap = null;
+ mRenderableMeshMap = null;
mRootTransforms = null;
}
@@ -220,27 +220,27 @@
start = System.currentTimeMillis();
Allocation drawableData = Allocation.createSized(rs,
Element.ALLOCATION(rs),
- mDrawables.size());
- Allocation[] drawableAllocs = new Allocation[mDrawables.size()];
- for (int i = 0; i < mDrawables.size(); i ++) {
- Drawable dI = (Drawable)mDrawables.get(i);
+ mRenderables.size());
+ Allocation[] drawableAllocs = new Allocation[mRenderables.size()];
+ for (int i = 0; i < mRenderables.size(); i ++) {
+ Renderable dI = (Renderable)mRenderables.get(i);
dI.sceneIndex = i;
addToMeshMap(dI);
drawableAllocs[i] = dI.getRsField(rs, res).getAllocation();
}
drawableData.copyFrom(drawableAllocs);
- sceneManager.mRenderLoop.set_gDrawableObjects(drawableData);
+ sceneManager.mRenderLoop.set_gRenderableObjects(drawableData);
initRenderPassRS(rs, sceneManager);
new ImageLoaderTask().execute();
end = System.currentTimeMillis();
- Log.v(TIMER_TAG, "Drawable init time: " + (end - start));
+ Log.v(TIMER_TAG, "Renderable init time: " + (end - start));
- Allocation opaqueBuffer = Allocation.createSized(rs, Element.U32(rs), mDrawables.size());
+ Allocation opaqueBuffer = Allocation.createSized(rs, Element.U32(rs), mRenderables.size());
Allocation transparentBuffer = Allocation.createSized(rs,
- Element.U32(rs), mDrawables.size());
+ Element.U32(rs), mRenderables.size());
sceneManager.mRenderLoop.bind_gFrontToBack(opaqueBuffer);
sceneManager.mRenderLoop.bind_gBackToFront(transparentBuffer);
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
index 7b710ee..5bb821f 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
@@ -84,7 +84,7 @@
// This is just a hardcoded object in the scene that gets turned on and off for the demo
// to make things look a bit better. This could be deleted in the cleanup
- Drawable plane = (Drawable)mActiveScene.getDrawableByName("pPlaneShape1");
+ Renderable plane = (Renderable)mActiveScene.getRenderableByName("pPlaneShape1");
if (plane != null) {
plane.setVisible(mRS, !mUseBlur);
}
@@ -362,7 +362,7 @@
}
void initRenderPasses() {
- ArrayList<DrawableBase> allDraw = mActiveScene.getDrawables();
+ ArrayList<RenderableBase> allDraw = mActiveScene.getRenderables();
int numDraw = allDraw.size();
if (mUseBlur) {
@@ -376,7 +376,7 @@
mainPass.setShouldClearDepth(true);
mainPass.setCamera(mActiveScene.getCameras().get(1));
for (int i = 0; i < numDraw; i ++) {
- mainPass.appendDrawable((Drawable)allDraw.get(i));
+ mainPass.appendRenderable((Renderable)allDraw.get(i));
}
mActiveScene.appendRenderPass(mainPass);
@@ -412,7 +412,7 @@
mActiveScene.assignRenderStateToMaterial(glassTransp, "^#GlassLight");
- Drawable plane = (Drawable)mActiveScene.getDrawableByName("pPlaneShape1");
+ Renderable plane = (Renderable)mActiveScene.getRenderableByName("pPlaneShape1");
if (plane != null) {
RenderState texState = new RenderState(mPV_Paint, mPF_Texture, null, null);
plane.setRenderState(texState);
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/export.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/export.rs
index 1dfe633..e00e507 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/export.rs
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/export.rs
@@ -21,7 +21,7 @@
#include "transform_def.rsh"
SgTransform *exportPtr;
SgRenderState *sExport;
-SgDrawable *drExport;
+SgRenderable *drExport;
SgRenderPass *pExport;
SgCamera *exportPtrCam;
FBlurOffsets *blurExport;
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
index d7343dc..4b85d72 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
@@ -24,7 +24,7 @@
SgTransform *gRootNode;
rs_allocation gCameras;
-rs_allocation gDrawableObjects;
+rs_allocation gRenderableObjects;
rs_allocation gRenderPasses;
@@ -46,7 +46,7 @@
static rs_allocation nullAlloc;
//#define DEBUG_RENDERABLES
-static void draw(SgDrawable *obj) {
+static void draw(SgRenderable *obj) {
const SgRenderState *renderState = (const SgRenderState *)rsGetElementAt(obj->render_state, 0);
const SgTransform *objTransform = (const SgTransform *)rsGetElementAt(obj->transformMatrix, 0);
@@ -90,7 +90,7 @@
rsgDrawMesh(obj->mesh, obj->meshIndex);
}
-static void getTransformedSphere(SgDrawable *obj) {
+static void getTransformedSphere(SgRenderable *obj) {
obj->worldBoundingSphere = obj->boundingSphere;
obj->worldBoundingSphere.w = 1.0f;
const SgTransform *objTransform = (const SgTransform *)rsGetElementAt(obj->transformMatrix, 0);
@@ -102,7 +102,7 @@
obj->worldBoundingSphere.w = obj->boundingSphere.w * length(scaledVec);
}
-static bool frustumCulled(SgDrawable *obj) {
+static bool frustumCulled(SgRenderable *obj) {
if (!obj->bVolInitialized) {
float minX, minY, minZ, maxX, maxY, maxZ;
rsgMeshComputeBoundingBox(obj->mesh,
@@ -133,7 +133,7 @@
&gFrustumPlanes[3], &gFrustumPlanes[4]);
}
-static void sortToBucket(SgDrawable *obj) {
+static void sortToBucket(SgRenderable *obj) {
// Not loaded yet
if (!rsIsObject(obj->mesh) || obj->cullType == 2) {
return;
@@ -178,12 +178,12 @@
static void drawSorted() {
for (int i = 0; i < gFrontToBackCount; i ++) {
- SgDrawable *current = (SgDrawable*)gFrontToBack[i];
+ SgRenderable *current = (SgRenderable*)gFrontToBack[i];
draw(current);
}
for (int i = 0; i < gBackToFrontCount; i ++) {
- SgDrawable *current = (SgDrawable*)gBackToFront[i];
+ SgRenderable *current = (SgRenderable*)gBackToFront[i];
draw(current);
}
}
@@ -192,10 +192,10 @@
if (!rsIsObject(allObj)) {
return;
}
- int numDrawables = rsAllocationGetDimX(allObj);
- for (int i = 0; i < numDrawables; i ++) {
+ int numRenderables = rsAllocationGetDimX(allObj);
+ for (int i = 0; i < numRenderables; i ++) {
rs_allocation *drawAlloc = (rs_allocation*)rsGetElementAt(allObj, i);
- SgDrawable *current = (SgDrawable*)rsGetElementAt(*drawAlloc, 0);
+ SgRenderable *current = (SgRenderable*)rsGetElementAt(*drawAlloc, 0);
sortToBucket(current);
}
drawSorted();
@@ -211,7 +211,7 @@
rsgClearDepth(1.0f);
- int numDrawables = rsAllocationGetDimX(gDrawableObjects);
+ int numRenderables = rsAllocationGetDimX(gRenderableObjects);
if (rsIsObject(gRenderPasses)) {
int numPasses = rsAllocationGetDimX(gRenderPasses);
for (uint i = 0; i < numPasses; i ++) {
@@ -245,11 +245,11 @@
rsgClearDepth(1.0f);
rs_allocation *camAlloc = (rs_allocation*)rsGetElementAt(gCameras, 1);
updateActiveCamera(*camAlloc);
- drawAllObjects(gDrawableObjects);
+ drawAllObjects(gRenderableObjects);
}
}
-static bool intersect(const SgDrawable *obj, float3 pnt, float3 vec) {
+static bool intersect(const SgRenderable *obj, float3 pnt, float3 vec) {
// Solving for t^2 + Bt + C = 0
float3 originMinusCenter = pnt - obj->worldBoundingSphere.xyz;
float B = dot(originMinusCenter, vec) * 2.0f;
@@ -284,7 +284,7 @@
getCameraRay(gActiveCamera, screenX, screenY, &pnt, &vec);
for (int i = 0; i < gFrontToBackCount; i ++) {
- SgDrawable *current = (SgDrawable*)gFrontToBack[i];
+ SgRenderable *current = (SgRenderable*)gFrontToBack[i];
bool isPicked = intersect(current, pnt, vec);
if (isPicked) {
current->cullType = 2;
@@ -292,7 +292,7 @@
}
for (int i = 0; i < gBackToFrontCount; i ++) {
- SgDrawable *current = (SgDrawable*)gBackToFront[i];
+ SgRenderable *current = (SgRenderable*)gBackToFront[i];
bool isPicked = intersect(current, pnt, vec);
if (isPicked) {
current->cullType = 2;
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform_def.rsh b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform_def.rsh
index e093bf9..143e50d 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform_def.rsh
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform_def.rsh
@@ -55,7 +55,7 @@
rs_program_raster pr;
} SgRenderState;
-typedef struct Drawable_s {
+typedef struct Renderable_s {
rs_allocation render_state;
rs_allocation pv_const;
rs_allocation pf_const;
@@ -69,7 +69,7 @@
float4 worldBoundingSphere;
int bVolInitialized;
int cullType; // specifies whether to frustum cull
-} SgDrawable;
+} SgRenderable;
typedef struct RenderPass_s {
rs_allocation color_target;