summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2010-07-18 23:38:33 -0700
committerShih-wei Liao <sliao@google.com>2010-07-19 17:39:46 -0700
commitbbcb0fd07eab29338af3521ea0a6f30bf95ac2de (patch)
tree7e0b777aa6f6e8f20333dcf59a598b0b59489908
parent1ba864e729a2e6a55a6ffc1d5b67a0574faf92fb (diff)
downloadandroid_packages_wallpapers_Basic-bbcb0fd07eab29338af3521ea0a6f30bf95ac2de.tar.gz
android_packages_wallpapers_Basic-bbcb0fd07eab29338af3521ea0a6f30bf95ac2de.tar.bz2
android_packages_wallpapers_Basic-bbcb0fd07eab29338af3521ea0a6f30bf95ac2de.zip
Using the new auto build system for RenderScript.
Change-Id: Ie9d7442ae86748ea42bc7538aa1ec1f5cddb9a11
-rw-r--r--Android.mk2
-rw-r--r--res/raw/distort.rs545
-rw-r--r--res/raw/fall_bc.bcbin13064 -> 0 bytes
-rw-r--r--res/raw/galaxy_bc.bcbin9928 -> 0 bytes
-rw-r--r--res/raw/grass_bc.bcbin11044 -> 0 bytes
-rw-r--r--res/raw/nexus_bc.bcbin7288 -> 0 bytes
-rw-r--r--src/com/android/wallpaper/fall/FallRS.java2
-rw-r--r--src/com/android/wallpaper/fall/ScriptC_Fall.java234
-rw-r--r--src/com/android/wallpaper/fall/ScriptField_Constants.java117
-rw-r--r--src/com/android/wallpaper/fall/fall.rs (renamed from res/raw/fall.rs)6
-rw-r--r--src/com/android/wallpaper/galaxy/GalaxyRS.java2
-rw-r--r--src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java163
-rw-r--r--src/com/android/wallpaper/galaxy/ScriptField_Particle.java78
-rw-r--r--src/com/android/wallpaper/galaxy/galaxy.rs (renamed from res/raw/galaxy.rs)6
-rw-r--r--src/com/android/wallpaper/grass/GrassRS.java2
-rw-r--r--src/com/android/wallpaper/grass/ScriptC_Grass.java279
-rw-r--r--src/com/android/wallpaper/grass/ScriptField_Blade.java107
-rw-r--r--src/com/android/wallpaper/grass/ScriptField_Vertex.java80
-rw-r--r--src/com/android/wallpaper/grass/grass.rs (renamed from res/raw/grass.rs)6
-rw-r--r--src/com/android/wallpaper/nexus/NexusRS.java2
-rw-r--r--src/com/android/wallpaper/nexus/ScriptC_Nexus.java142
-rw-r--r--src/com/android/wallpaper/nexus/nexus.rs (renamed from res/raw/nexus.rs)6
22 files changed, 17 insertions, 1762 deletions
diff --git a/Android.mk b/Android.mk
index adfdb92..37a59b4 100644
--- a/Android.mk
+++ b/Android.mk
@@ -19,7 +19,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-renderscript-files-under, src)
LOCAL_PACKAGE_NAME := LiveWallpapers
LOCAL_CERTIFICATE := shared
diff --git a/res/raw/distort.rs b/res/raw/distort.rs
deleted file mode 100644
index 7a874ce..0000000
--- a/res/raw/distort.rs
+++ /dev/null
@@ -1,545 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma version(1)
-#pragma stateVertex(PVSky)
-#pragma stateFragment(PFBackground)
-#pragma stateStore(PFSBackground)
-
-#define RSID_RIPPLE_MAP 1
-#define RSID_REFRACTION_MAP 2
-
-#define LEAVES_TEXTURES_COUNT 4
-
-#define LEAF_SIZE 0.55f
-
-#define REFRACTION 1.333f
-#define DAMP 3
-
-#define DROP_RADIUS 2
-// The higher, the smaller the ripple
-#define RIPPLE_HEIGHT 10.0f
-
-float skyOffsetX;
-float skyOffsetY;
-
-int lastDrop;
-
-struct vert_s {
- float x;
- float y;
- float z;
- float s;
- float t;
- float nx;
- float ny;
- float nz;
-};
-
-struct drop_s {
- float amp;
- float phase;
- float x;
- float y;
-};
-struct drop_s gDrops[10];
-
-int offset(int x, int y, int width) {
- return x + 1 + (y + 1) * (width + 2);
-}
-
-void init() {
- gDrops[0].amp = 0.2f;
- gDrops[0].phase = 0;
-}
-
-void initLeaves() {
- if (State->isPreview) lastDrop = uptimeMillis();
-
- struct Leaves_s *leaf = Leaves;
- int leavesCount = State->leavesCount;
- float width = State->glWidth;
- float height = State->glHeight;
-
- int i;
- for (i = 0; i < leavesCount; i ++) {
- int sprite = randf(LEAVES_TEXTURES_COUNT);
- leaf->x = randf2(-width * 0.5f, width * 0.5f);
- leaf->y = randf2(-height * 0.5f, height * 0.5f);
- leaf->scale = randf2(0.4f, 0.5f);
- leaf->angle = randf2(0.0f, 360.0f);
- leaf->spin = degf(randf2(-0.02f, 0.02f)) * 0.25f;
- leaf->u1 = sprite / (float) LEAVES_TEXTURES_COUNT;
- leaf->u2 = (sprite + 1) / (float) LEAVES_TEXTURES_COUNT;
- leaf->altitude = -1.0f;
- leaf->rippled = 1.0f;
- leaf->deltaX = randf2(-0.02f, 0.02f) / 60.0f;
- leaf->deltaY = -0.08f * randf2(0.9f, 1.1f) / 60.0f;
- leaf++;
- }
-}
-
-void dropWithStrength(int x, int y, int r, int s) {
- int width = State->meshWidth;
- int height = State->meshHeight;
-
- if (x < r) x = r;
- if (y < r) y = r;
- if (x >= width - r) x = width - r - 1;
- if (y >= height - r) y = height - r - 1;
-
- x = width - x;
-
- int rippleMapSize = State->rippleMapSize;
- int index = State->rippleIndex;
- int origin = offset(0, 0, width);
-
- int* current = loadArrayI32(RSID_RIPPLE_MAP, index * rippleMapSize + origin);
- int sqr = r * r;
- float invs = 1.0f / s;
-
- int h = 0;
- for ( ; h < r; h += 1) {
- int sqv = h * h;
- int yn = origin + (y - h) * (width + 2);
- int yp = origin + (y + h) * (width + 2);
- int w = 0;
- for ( ; w < r; w += 1) {
- int squ = w * w;
- if (squ + sqv < sqr) {
- int v = -sqrtf((sqr - (squ + sqv)) << 16) * invs;
- current[yn + x + w] = v;
- current[yp + x + w] = v;
- current[yn + x - w] = v;
- current[yp + x - w] = v;
- }
- }
- }
-}
-
-void drop(int x, int y, int r) {
- dropWithStrength(x, y, r, 1);
-}
-
-void updateRipples() {
- int rippleMapSize = State->rippleMapSize;
- int width = State->meshWidth;
- int height = State->meshHeight;
- int index = State->rippleIndex;
- int origin = offset(0, 0, width);
-
- int* current = loadArrayI32(RSID_RIPPLE_MAP, index * rippleMapSize + origin);
- int* next = loadArrayI32(RSID_RIPPLE_MAP, (1 - index) * rippleMapSize + origin);
-
- State->rippleIndex = 1 - index;
-
- int a = 1;
- int b = width + 2;
- int h = height;
- while (h) {
- int w = width;
- while (w) {
- int droplet = ((current[-b] + current[b] + current[-a] + current[a]) >> 1) - *next;
- *next = droplet - (droplet >> DAMP);
- current += 1;
- next += 1;
- w -= 1;
- }
- current += 2;
- next += 2;
- h -= 1;
- }
-}
-
-int refraction(int d, int wave, int *map) {
- int i = d;
- if (i < 0) i = -i;
- if (i > 512) i = 512;
- int w = (wave + 0x10000) >> 8;
- w &= ~(w >> 31);
- int r = (map[i] * w) >> 3;
- if (d < 0) {
- return -r;
- }
- return r;
-}
-
-void generateRipples() {
- int rippleMapSize = State->rippleMapSize;
- int width = State->meshWidth;
- int height = State->meshHeight;
- int index = State->rippleIndex;
- int origin = offset(0, 0, width);
-
- int b = width + 2;
-
- int* current = loadArrayI32(RSID_RIPPLE_MAP, index * rippleMapSize + origin);
- int *map = loadArrayI32(RSID_REFRACTION_MAP, 0);
- float *vertices = loadSimpleMeshVerticesF(NAMED_WaterMesh, 0);
- struct vert_s *vert = (struct vert_s *)vertices;
-
- float fw = 1.0f / width;
- float fh = 1.0f / height;
- float fy = (1.0f / 512.0f) * (1.0f / RIPPLE_HEIGHT);
-/*
- int h = height - 1;
- while (h >= 0) {
- int w = width - 1;
- int wave = *current;
- int offset = h * width;
- struct vert_s *vtx = vert + offset + w;
-
- while (w >= 0) {
- int nextWave = current[1];
- int dx = nextWave - wave;
- int dy = current[b] - wave;
-
- int offsetx = refraction(dx, wave, map) >> 16;
- int u = (width - w) + offsetx;
- u &= ~(u >> 31);
- if (u >= width) u = width - 1;
-
- int offsety = refraction(dy, wave, map) >> 16;
- int v = (height - h) + offsety;
- v &= ~(v >> 31);
- if (v >= height) v = height - 1;
-
- vtx->s = u * fw;
- vtx->t = v * fh;
- vtx->z = dy * fy;
- debugF("es", vtx->s);
- vtx --;
-
- w -= 1;
- current += 1;
- wave = nextWave;
- }
- h -= 1;
- current += 2;
- }
-*/
- {
- gDrops[0].x = width / 2;
- gDrops[0].y = height / 2;
-
- int x, y;
- struct vert_s *vtx = vert;
- for (y=0; y < height; y++) {
- for (x=0; x < width; x++) {
- struct drop_s * d = &gDrops[0];
- float z = 0;
-
- {
- float dx = d->x - x;
- float dy = d->y - y;
- float dist = sqrtf(dx*dx + dy*dy);
- z = sinf(dist + d->phase) * d->amp;
-
- vtx->s = (float)x / width;
- vtx->t = (float)y / height;
- vtx->z = z;
- vtx ++;
- }
- }
- }
- gDrops[0].phase += 0.02;
- }
-
- // Compute the normals for lighting
- int y = 0;
- for ( ; y < (height-1); y += 1) {
- int x = 0;
- int yOffset = y * width;
- struct vert_s *v = vert;
- v += y * width;
-
- for ( ; x < (width-1); x += 1) {
- struct vec3_s n1, n2, n3;
- vec3Sub(&n1, (struct vec3_s *)&(v+1)->x, (struct vec3_s *)&v->x);
- vec3Sub(&n2, (struct vec3_s *)&(v+width)->x, (struct vec3_s *)&v->x);
- vec3Cross(&n3, &n1, &n2);
- vec3Norm(&n3);
-
- // Average of previous normal and N1 x N2
- vec3Sub(&n1, (struct vec3_s *)&(v+width+1)->x, (struct vec3_s *)&v->x);
- vec3Cross(&n2, &n1, &n2);
- vec3Add(&n3, &n3, &n2);
- vec3Norm(&n3);
-
- v->nx = n3.x;
- v->ny = n3.y;
- v->nz = -n3.z;
- v->s += v->nx * 0.01;
- v->t += v->ny * 0.01;
- v += 1;
-
- // reset Z
- //vertices[(yOffset + x) << 3 + 7] = 0.0f;
- }
- }
-}
-
-void drawLeaf(struct Leaves_s *leaf, int meshWidth, int meshHeight, float glWidth, float glHeight,
- int rotate) {
-
- float x = leaf->x;
- float x1 = x - LEAF_SIZE;
- float x2 = x + LEAF_SIZE;
-
- float y = leaf->y;
- float y1 = y - LEAF_SIZE;
- float y2 = y + LEAF_SIZE;
-
- float u1 = leaf->u1;
- float u2 = leaf->u2;
-
- float z1 = 0.0f;
- float z2 = 0.0f;
- float z3 = 0.0f;
- float z4 = 0.0f;
-
- float a = leaf->altitude;
- float s = leaf->scale;
- float r = leaf->angle;
-
- float tz = 0.0f;
- if (a > 0.0f) {
- tz = -a;
- }
-
- x1 -= x;
- x2 -= x;
- y1 -= y;
- y2 -= y;
-
- float matrix[16];
-
- if (a > 0.0f) {
- color(0.0f, 0.0f, 0.0f, 0.15f);
-
- if (rotate) {
- matrixLoadRotate(matrix, 90.0f, 0.0f, 0.0f, 1.0f);
- } else {
- matrixLoadIdentity(matrix);
- }
- matrixTranslate(matrix, x, y, 0.0f);
- matrixScale(matrix, s, s, 1.0f);
- matrixRotate(matrix, r, 0.0f, 0.0f, 1.0f);
- vpLoadModelMatrix(matrix);
-
- drawQuadTexCoords(x1, y1, z1, u1, 1.0f,
- x2, y1, z2, u2, 1.0f,
- x2, y2, z3, u2, 0.0f,
- x1, y2, z4, u1, 0.0f);
-
- float alpha = 1.0f;
- if (a >= 0.4f) alpha = 1.0f - (a - 0.5f) / 0.1f;
- color(1.0f, 1.0f, 1.0f, alpha);
- } else {
- color(1.0f, 1.0f, 1.0f, 1.0f);
- }
-
- if (rotate) {
- matrixLoadRotate(matrix, 90.0f, 0.0f, 0.0f, 1.0f);
- } else {
- matrixLoadIdentity(matrix);
- }
- matrixTranslate(matrix, x, y, tz);
- matrixScale(matrix, s, s, 1.0f);
- matrixRotate(matrix, r, 0.0f, 0.0f, 1.0f);
- vpLoadModelMatrix(matrix);
-
- drawQuadTexCoords(x1, y1, z1, u1, 1.0f,
- x2, y1, z2, u2, 1.0f,
- x2, y2, z3, u2, 0.0f,
- x1, y2, z4, u1, 0.0f);
-
- float spin = leaf->spin;
- if (a <= 0.0f) {
- float rippled = leaf->rippled;
- if (rippled < 0.0f) {
- drop(((x + glWidth * 0.5f) / glWidth) * meshWidth,
- meshHeight - ((y + glHeight * 0.5f) / glHeight) * meshHeight, 1);
- spin /= 4.0f;
- leaf->spin = spin;
- leaf->rippled = 1.0f;
- }
- leaf->x = x + leaf->deltaX;
- leaf->y = y + leaf->deltaY;
- r += spin;
- leaf->angle = r;
- } else {
- a -= 0.005f;
- leaf->altitude = a;
- r += spin * 2.0f;
- leaf->angle = r;
- }
-
- if (-LEAF_SIZE * s + x > glWidth / 2.0f || LEAF_SIZE * s + x < -glWidth / 2.0f ||
- LEAF_SIZE * s + y < -glHeight / 2.0f) {
-
- int sprite = randf(LEAVES_TEXTURES_COUNT);
- leaf->x = randf2(-glWidth * 0.5f, glWidth * 0.5f);
- leaf->y = randf2(-glHeight * 0.5f, glHeight * 0.5f);
- leaf->scale = randf2(0.4f, 0.5f);
- leaf->spin = degf(randf2(-0.02f, 0.02f)) * 0.25f;
- leaf->u1 = sprite / (float) LEAVES_TEXTURES_COUNT;
- leaf->u2 = (sprite + 1) / (float) LEAVES_TEXTURES_COUNT;
- leaf->altitude = 0.6f;
- leaf->rippled = -1.0f;
- leaf->deltaX = randf2(-0.02f, 0.02f) / 60.0f;
- leaf->deltaY = -0.08f * randf2(0.9f, 1.1f) / 60.0f;
- }
-}
-
-void drawLeaves() {
- bindProgramFragment(NAMED_PFSky);
- bindProgramStore(NAMED_PFSLeaf);
- bindProgramVertex(NAMED_PVSky);
- bindTexture(NAMED_PFSky, 0, NAMED_TLeaves);
-
- color(1.0f, 1.0f, 1.0f, 1.0f);
-
- int leavesCount = State->leavesCount;
- int width = State->meshWidth;
- int height = State->meshHeight;
- float glWidth = State->glWidth;
- float glHeight = State->glHeight;
- int rotate = State->rotate;
-
- struct Leaves_s *leaf = Leaves;
-
- int i = 0;
- for ( ; i < leavesCount; i += 1) {
- drawLeaf(leaf, width, height, glWidth, glHeight, rotate);
- leaf += 1;
- }
-
- float matrix[16];
- matrixLoadIdentity(matrix);
- vpLoadModelMatrix(matrix);
-}
-
-void drawRiverbed() {
- bindTexture(NAMED_PFBackground, 0, NAMED_TRiverbed);
-
- drawSimpleMesh(NAMED_WaterMesh);
-}
-
-void drawSky() {
- color(1.0f, 1.0f, 1.0f, 0.4f);
-
- bindProgramFragment(NAMED_PFSky);
- bindProgramStore(NAMED_PFSLeaf);
- bindTexture(NAMED_PFSky, 0, NAMED_TSky);
-
- float x = skyOffsetX + State->skySpeedX;
- float y = skyOffsetY + State->skySpeedY;
-
- if (x > 1.0f) x = 0.0f;
- if (x < -1.0f) x = 0.0f;
- if (y > 1.0f) y = 0.0f;
-
- skyOffsetX = x;
- skyOffsetY = y;
-
- float matrix[16];
- matrixLoadTranslate(matrix, x, y, 0.0f);
- vpLoadTextureMatrix(matrix);
-
- drawSimpleMesh(NAMED_WaterMesh);
-
- matrixLoadIdentity(matrix);
- vpLoadTextureMatrix(matrix);
-}
-
-void drawLighting() {
- ambient(0.0f, 0.0f, 0.0f, 1.0f);
- diffuse(0.0f, 0.0f, 0.0f, 1.0f);
- specular(0.44f, 0.44f, 0.44f, 1.0f);
- shininess(40.0f);
-
- bindProgramStore(NAMED_PFSBackground);
- bindProgramFragment(NAMED_PFLighting);
- bindProgramVertex(NAMED_PVLight);
-
- drawSimpleMesh(NAMED_WaterMesh);
-}
-
-void drawNormals() {
- int width = State->meshWidth;
- int height = State->meshHeight;
-
- float *vertices = loadSimpleMeshVerticesF(NAMED_WaterMesh, 0);
-
- bindProgramVertex(NAMED_PVSky);
- bindProgramFragment(NAMED_PFLighting);
-
- color(1.0f, 0.0f, 0.0f, 1.0f);
-
- float scale = 1.0f / 10.0f;
- int y = 0;
- for ( ; y < height; y += 1) {
- int yOffset = y * width;
- int x = 0;
- for ( ; x < width; x += 1) {
- int offset = (yOffset + x) << 3;
- float vx = vertices[offset + 5];
- float vy = vertices[offset + 6];
- float vz = vertices[offset + 7];
- float nx = vertices[offset + 0];
- float ny = vertices[offset + 1];
- float nz = vertices[offset + 2];
- drawLine(vx, vy, vz, vx + nx * scale, vy + ny * scale, vz + nz * scale);
- }
- }
-}
-
-int main(int index) {
- if (Drop->dropX != -1) {
- drop(Drop->dropX, Drop->dropY, DROP_RADIUS);
- Drop->dropX = -1;
- Drop->dropY = -1;
- }
-
- if (State->isPreview) {
- int now = uptimeMillis();
- if (now - lastDrop > 2000) {
- float x = randf(State->meshWidth);
- float y = randf(State->meshHeight);
-
- drop(x, y, DROP_RADIUS);
-
- lastDrop = now;
- }
- }
-
- updateRipples();
- generateRipples();
- updateSimpleMesh(NAMED_WaterMesh);
-
- if (State->rotate) {
- float matrix[16];
- matrixLoadRotate(matrix, 90.0f, 0.0f, 0.0f, 1.0f);
- vpLoadModelMatrix(matrix);
- }
-
- drawRiverbed();
- //drawSky();
- drawLighting();
- //drawLeaves();
- //drawNormals();
-
- return 1;
-}
diff --git a/res/raw/fall_bc.bc b/res/raw/fall_bc.bc
deleted file mode 100644
index 52d1208..0000000
--- a/res/raw/fall_bc.bc
+++ /dev/null
Binary files differ
diff --git a/res/raw/galaxy_bc.bc b/res/raw/galaxy_bc.bc
deleted file mode 100644
index 4d5eb9e..0000000
--- a/res/raw/galaxy_bc.bc
+++ /dev/null
Binary files differ
diff --git a/res/raw/grass_bc.bc b/res/raw/grass_bc.bc
deleted file mode 100644
index 900abf6..0000000
--- a/res/raw/grass_bc.bc
+++ /dev/null
Binary files differ
diff --git a/res/raw/nexus_bc.bc b/res/raw/nexus_bc.bc
deleted file mode 100644
index 197d4a4..0000000
--- a/res/raw/nexus_bc.bc
+++ /dev/null
Binary files differ
diff --git a/src/com/android/wallpaper/fall/FallRS.java b/src/com/android/wallpaper/fall/FallRS.java
index 1029d7e..bdb75db 100644
--- a/src/com/android/wallpaper/fall/FallRS.java
+++ b/src/com/android/wallpaper/fall/FallRS.java
@@ -142,7 +142,7 @@ class FallRS extends RenderScriptScene {
@Override
protected ScriptC createScript() {
- mScript = new ScriptC_Fall(mRS, mResources, R.raw.fall_bc, true);
+ mScript = new ScriptC_Fall(mRS, mResources, R.raw.fall, true);
createMesh();
createState();
diff --git a/src/com/android/wallpaper/fall/ScriptC_Fall.java b/src/com/android/wallpaper/fall/ScriptC_Fall.java
deleted file mode 100644
index a67f531..0000000
--- a/src/com/android/wallpaper/fall/ScriptC_Fall.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.fall;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptC_Fall extends ScriptC {
- // Constructor
- public ScriptC_Fall(RenderScript rs, Resources resources, int id, boolean isRoot) {
- super(rs, resources, id, isRoot);
- }
-
- private final static int mExportVarIdx_g_glWidth = 0;
- private float mExportVar_g_glWidth;
- public void set_g_glWidth(float v) {
- mExportVar_g_glWidth = v;
- setVar(mExportVarIdx_g_glWidth, v);
- }
-
- public float get_g_glWidth() {
- return mExportVar_g_glWidth;
- }
-
- private final static int mExportVarIdx_g_glHeight = 1;
- private float mExportVar_g_glHeight;
- public void set_g_glHeight(float v) {
- mExportVar_g_glHeight = v;
- setVar(mExportVarIdx_g_glHeight, v);
- }
-
- public float get_g_glHeight() {
- return mExportVar_g_glHeight;
- }
-
- private final static int mExportVarIdx_g_meshWidth = 2;
- private float mExportVar_g_meshWidth;
- public void set_g_meshWidth(float v) {
- mExportVar_g_meshWidth = v;
- setVar(mExportVarIdx_g_meshWidth, v);
- }
-
- public float get_g_meshWidth() {
- return mExportVar_g_meshWidth;
- }
-
- private final static int mExportVarIdx_g_meshHeight = 3;
- private float mExportVar_g_meshHeight;
- public void set_g_meshHeight(float v) {
- mExportVar_g_meshHeight = v;
- setVar(mExportVarIdx_g_meshHeight, v);
- }
-
- public float get_g_meshHeight() {
- return mExportVar_g_meshHeight;
- }
-
- private final static int mExportVarIdx_g_xOffset = 4;
- private float mExportVar_g_xOffset;
- public void set_g_xOffset(float v) {
- mExportVar_g_xOffset = v;
- setVar(mExportVarIdx_g_xOffset, v);
- }
-
- public float get_g_xOffset() {
- return mExportVar_g_xOffset;
- }
-
- private final static int mExportVarIdx_g_rotate = 5;
- private float mExportVar_g_rotate;
- public void set_g_rotate(float v) {
- mExportVar_g_rotate = v;
- setVar(mExportVarIdx_g_rotate, v);
- }
-
- public float get_g_rotate() {
- return mExportVar_g_rotate;
- }
-
- private final static int mExportVarIdx_g_newDropX = 6;
- private int mExportVar_g_newDropX;
- public void set_g_newDropX(int v) {
- mExportVar_g_newDropX = v;
- setVar(mExportVarIdx_g_newDropX, v);
- }
-
- public int get_g_newDropX() {
- return mExportVar_g_newDropX;
- }
-
- private final static int mExportVarIdx_g_newDropY = 7;
- private int mExportVar_g_newDropY;
- public void set_g_newDropY(int v) {
- mExportVar_g_newDropY = v;
- setVar(mExportVarIdx_g_newDropY, v);
- }
-
- public int get_g_newDropY() {
- return mExportVar_g_newDropY;
- }
-
- private final static int mExportVarIdx_g_PVWater = 8;
- private ProgramVertex mExportVar_g_PVWater;
- public void set_g_PVWater(ProgramVertex v) {
- mExportVar_g_PVWater = v;
- setVar(mExportVarIdx_g_PVWater, (v == null) ? 0 : v.getID());
- }
-
- public ProgramVertex get_g_PVWater() {
- return mExportVar_g_PVWater;
- }
-
- private final static int mExportVarIdx_g_PVSky = 9;
- private ProgramVertex mExportVar_g_PVSky;
- public void set_g_PVSky(ProgramVertex v) {
- mExportVar_g_PVSky = v;
- setVar(mExportVarIdx_g_PVSky, (v == null) ? 0 : v.getID());
- }
-
- public ProgramVertex get_g_PVSky() {
- return mExportVar_g_PVSky;
- }
-
- private final static int mExportVarIdx_g_PFSky = 10;
- private ProgramFragment mExportVar_g_PFSky;
- public void set_g_PFSky(ProgramFragment v) {
- mExportVar_g_PFSky = v;
- setVar(mExportVarIdx_g_PFSky, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_g_PFSky() {
- return mExportVar_g_PFSky;
- }
-
- private final static int mExportVarIdx_g_PFSLeaf = 11;
- private ProgramStore mExportVar_g_PFSLeaf;
- public void set_g_PFSLeaf(ProgramStore v) {
- mExportVar_g_PFSLeaf = v;
- setVar(mExportVarIdx_g_PFSLeaf, (v == null) ? 0 : v.getID());
- }
-
- public ProgramStore get_g_PFSLeaf() {
- return mExportVar_g_PFSLeaf;
- }
-
- private final static int mExportVarIdx_g_PFBackground = 12;
- private ProgramFragment mExportVar_g_PFBackground;
- public void set_g_PFBackground(ProgramFragment v) {
- mExportVar_g_PFBackground = v;
- setVar(mExportVarIdx_g_PFBackground, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_g_PFBackground() {
- return mExportVar_g_PFBackground;
- }
-
- private final static int mExportVarIdx_g_TLeaves = 13;
- private Allocation mExportVar_g_TLeaves;
- public void set_g_TLeaves(Allocation v) {
- mExportVar_g_TLeaves = v;
- setVar(mExportVarIdx_g_TLeaves, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_g_TLeaves() {
- return mExportVar_g_TLeaves;
- }
-
- private final static int mExportVarIdx_g_TRiverbed = 14;
- private Allocation mExportVar_g_TRiverbed;
- public void set_g_TRiverbed(Allocation v) {
- mExportVar_g_TRiverbed = v;
- setVar(mExportVarIdx_g_TRiverbed, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_g_TRiverbed() {
- return mExportVar_g_TRiverbed;
- }
-
- private final static int mExportVarIdx_g_WaterMesh = 15;
- private Mesh mExportVar_g_WaterMesh;
- public void set_g_WaterMesh(Mesh v) {
- mExportVar_g_WaterMesh = v;
- setVar(mExportVarIdx_g_WaterMesh, (v == null) ? 0 : v.getID());
- }
-
- public Mesh get_g_WaterMesh() {
- return mExportVar_g_WaterMesh;
- }
-
- private final static int mExportVarIdx_g_Constants = 16;
- private ScriptField_Constants mExportVar_g_Constants;
- public void bind_g_Constants(ScriptField_Constants v) {
- mExportVar_g_Constants = v;
- if(v == null) bindAllocation(null, mExportVarIdx_g_Constants);
- else bindAllocation(v.getAllocation(), mExportVarIdx_g_Constants);
- }
-
- public ScriptField_Constants get_g_Constants() {
- return mExportVar_g_Constants;
- }
-
- private final static int mExportVarIdx_g_PFSBackground = 17;
- private ProgramStore mExportVar_g_PFSBackground;
- public void set_g_PFSBackground(ProgramStore v) {
- mExportVar_g_PFSBackground = v;
- setVar(mExportVarIdx_g_PFSBackground, (v == null) ? 0 : v.getID());
- }
-
- public ProgramStore get_g_PFSBackground() {
- return mExportVar_g_PFSBackground;
- }
-
- private final static int mExportFuncIdx_initLeaves = 0;
- public void invoke_initLeaves() {
- invoke(mExportFuncIdx_initLeaves);
- }
-
-}
-
diff --git a/src/com/android/wallpaper/fall/ScriptField_Constants.java b/src/com/android/wallpaper/fall/ScriptField_Constants.java
deleted file mode 100644
index 033a4b1..0000000
--- a/src/com/android/wallpaper/fall/ScriptField_Constants.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.fall;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptField_Constants extends android.renderscript.Script.FieldBase {
- static public class Item {
- public static final int sizeof = 192;
-
- Float4 Drop01;
- Float4 Drop02;
- Float4 Drop03;
- Float4 Drop04;
- Float4 Drop05;
- Float4 Drop06;
- Float4 Drop07;
- Float4 Drop08;
- Float4 Drop09;
- Float4 Drop10;
- Float4 Offset;
- float Rotate;
-
- Item() {
- Drop01 = new Float4();
- Drop02 = new Float4();
- Drop03 = new Float4();
- Drop04 = new Float4();
- Drop05 = new Float4();
- Drop06 = new Float4();
- Drop07 = new Float4();
- Drop08 = new Float4();
- Drop09 = new Float4();
- Drop10 = new Float4();
- Offset = new Float4();
- }
-
- }
-
- private Item mItemArray[];
- private FieldPacker mIOBuffer;
- public ScriptField_Constants(RenderScript rs, int count) {
- mItemArray = null;
- mIOBuffer = null;
- {
- Element.Builder eb = new Element.Builder(rs);
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop01");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop02");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop03");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop04");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop05");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop06");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop07");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop08");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop09");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Drop10");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 4), "Offset");
- eb.add(Element.F32(rs), "Rotate");
- /* eb.add(Element.U32(rs), "#padding_1");
- eb.add(Element.U32(rs), "#padding_2");
- eb.add(Element.U32(rs), "#padding_3");*/
- mElement = eb.create();
- }
-
- init(rs, count);
- }
-
- private void copyToArray(Item i, int index) {
- if (mIOBuffer == null) mIOBuffer = new FieldPacker(Item.sizeof * mType.getX() /* count */);
- mIOBuffer.reset(index * Item.sizeof);
- mIOBuffer.addF32(i.Drop01);
- mIOBuffer.addF32(i.Drop02);
- mIOBuffer.addF32(i.Drop03);
- mIOBuffer.addF32(i.Drop04);
- mIOBuffer.addF32(i.Drop05);
- mIOBuffer.addF32(i.Drop06);
- mIOBuffer.addF32(i.Drop07);
- mIOBuffer.addF32(i.Drop08);
- mIOBuffer.addF32(i.Drop09);
- mIOBuffer.addF32(i.Drop10);
- mIOBuffer.addF32(i.Offset);
- mIOBuffer.addF32(i.Rotate);
- mIOBuffer.skip(12);
- }
-
- public void set(Item i, int index, boolean copyNow) {
- if (mItemArray == null) mItemArray = new Item[mType.getX() /* count */];
- mItemArray[index] = i;
- if (copyNow) {
- copyToArray(i, index);
- mAllocation.subData1D(index * Item.sizeof, Item.sizeof, mIOBuffer.getData());
- }
-
- }
-
- public void copyAll() {
- for (int ct=0; ct < mItemArray.length; ct++) copyToArray(mItemArray[ct], ct);
- mAllocation.data(mIOBuffer.getData());
- }
-
-}
diff --git a/res/raw/fall.rs b/src/com/android/wallpaper/fall/fall.rs
index 010ee6e..36ae615 100644
--- a/res/raw/fall.rs
+++ b/src/com/android/wallpaper/fall/fall.rs
@@ -16,9 +16,9 @@
#pragma rs java_package_name(com.android.wallpaper.fall)
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_types.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_math.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_graphics.rsh"
+#include "rs_types.rsh"
+#include "rs_math.rsh"
+#include "rs_graphics.rsh"
#define LEAVES_TEXTURES_COUNT 8
#define LEAF_SIZE 0.55f
diff --git a/src/com/android/wallpaper/galaxy/GalaxyRS.java b/src/com/android/wallpaper/galaxy/GalaxyRS.java
index aa0cf02..082afb7 100644
--- a/src/com/android/wallpaper/galaxy/GalaxyRS.java
+++ b/src/com/android/wallpaper/galaxy/GalaxyRS.java
@@ -56,7 +56,7 @@ class GalaxyRS extends RenderScriptScene {
@Override
protected ScriptC createScript() {
- mScript = new ScriptC_Galaxy(mRS, mResources, R.raw.galaxy_bc, true);
+ mScript = new ScriptC_Galaxy(mRS, mResources, R.raw.galaxy, true);
mScript.set_gIsPreview(isPreview() ? 1 : 0);
if (isPreview()) {
mScript.set_gXOffset(0.5f);
diff --git a/src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java b/src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java
deleted file mode 100644
index 01c1a9b..0000000
--- a/src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.galaxy;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptC_Galaxy extends ScriptC {
- // Constructor
- public ScriptC_Galaxy(RenderScript rs, Resources resources, int id, boolean isRoot) {
- super(rs, resources, id, isRoot);
- }
-
- private final static int mExportVarIdx_gXOffset = 0;
- private float mExportVar_gXOffset;
- public void set_gXOffset(float v) {
- mExportVar_gXOffset = v;
- setVar(mExportVarIdx_gXOffset, v);
- }
-
- public float get_gXOffset() {
- return mExportVar_gXOffset;
- }
-
- private final static int mExportVarIdx_gIsPreview = 1;
- private int mExportVar_gIsPreview;
- public void set_gIsPreview(int v) {
- mExportVar_gIsPreview = v;
- setVar(mExportVarIdx_gIsPreview, v);
- }
-
- public int get_gIsPreview() {
- return mExportVar_gIsPreview;
- }
-
- private final static int mExportVarIdx_gPFBackground = 2;
- private ProgramFragment mExportVar_gPFBackground;
- public void set_gPFBackground(ProgramFragment v) {
- mExportVar_gPFBackground = v;
- setVar(mExportVarIdx_gPFBackground, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_gPFBackground() {
- return mExportVar_gPFBackground;
- }
-
- private final static int mExportVarIdx_gPFStars = 3;
- private ProgramFragment mExportVar_gPFStars;
- public void set_gPFStars(ProgramFragment v) {
- mExportVar_gPFStars = v;
- setVar(mExportVarIdx_gPFStars, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_gPFStars() {
- return mExportVar_gPFStars;
- }
-
- private final static int mExportVarIdx_gPVStars = 4;
- private ProgramVertex mExportVar_gPVStars;
- public void set_gPVStars(ProgramVertex v) {
- mExportVar_gPVStars = v;
- setVar(mExportVarIdx_gPVStars, (v == null) ? 0 : v.getID());
- }
-
- public ProgramVertex get_gPVStars() {
- return mExportVar_gPVStars;
- }
-
- private final static int mExportVarIdx_gPVBkProj = 5;
- private ProgramVertex mExportVar_gPVBkProj;
- public void set_gPVBkProj(ProgramVertex v) {
- mExportVar_gPVBkProj = v;
- setVar(mExportVarIdx_gPVBkProj, (v == null) ? 0 : v.getID());
- }
-
- public ProgramVertex get_gPVBkProj() {
- return mExportVar_gPVBkProj;
- }
-
- private final static int mExportVarIdx_gPSLights = 6;
- private ProgramStore mExportVar_gPSLights;
- public void set_gPSLights(ProgramStore v) {
- mExportVar_gPSLights = v;
- setVar(mExportVarIdx_gPSLights, (v == null) ? 0 : v.getID());
- }
-
- public ProgramStore get_gPSLights() {
- return mExportVar_gPSLights;
- }
-
- private final static int mExportVarIdx_gTSpace = 7;
- private Allocation mExportVar_gTSpace;
- public void set_gTSpace(Allocation v) {
- mExportVar_gTSpace = v;
- setVar(mExportVarIdx_gTSpace, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTSpace() {
- return mExportVar_gTSpace;
- }
-
- private final static int mExportVarIdx_gTFlares = 8;
- private Allocation mExportVar_gTFlares;
- public void set_gTFlares(Allocation v) {
- mExportVar_gTFlares = v;
- setVar(mExportVarIdx_gTFlares, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTFlares() {
- return mExportVar_gTFlares;
- }
-
- private final static int mExportVarIdx_gTLight1 = 9;
- private Allocation mExportVar_gTLight1;
- public void set_gTLight1(Allocation v) {
- mExportVar_gTLight1 = v;
- setVar(mExportVarIdx_gTLight1, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTLight1() {
- return mExportVar_gTLight1;
- }
-
- private final static int mExportVarIdx_gParticlesMesh = 10;
- private Mesh mExportVar_gParticlesMesh;
- public void set_gParticlesMesh(Mesh v) {
- mExportVar_gParticlesMesh = v;
- setVar(mExportVarIdx_gParticlesMesh, (v == null) ? 0 : v.getID());
- }
-
- public Mesh get_gParticlesMesh() {
- return mExportVar_gParticlesMesh;
- }
-
- private final static int mExportVarIdx_Particles = 11;
- private ScriptField_Particle mExportVar_Particles;
- public void bind_Particles(ScriptField_Particle v) {
- mExportVar_Particles = v;
- if(v == null) bindAllocation(null, mExportVarIdx_Particles);
- else bindAllocation(v.getAllocation(), mExportVarIdx_Particles);
- }
-
- public ScriptField_Particle get_Particles() {
- return mExportVar_Particles;
- }
-
-}
-
diff --git a/src/com/android/wallpaper/galaxy/ScriptField_Particle.java b/src/com/android/wallpaper/galaxy/ScriptField_Particle.java
deleted file mode 100644
index 9f0f12d..0000000
--- a/src/com/android/wallpaper/galaxy/ScriptField_Particle.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.galaxy;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptField_Particle extends android.renderscript.Script.FieldBase {
- static public class Item {
- public static final int sizeof = 20;
-
- Short4 color;
- Float3 position;
-
- Item() {
- color = new Short4();
- position = new Float3();
- }
-
- }
-
- private Item mItemArray[];
- private FieldPacker mIOBuffer;
- public static Element createElement(RenderScript rs) {
- Element.Builder eb = new Element.Builder(rs);
- eb.add(Element.createVector(rs, Element.DataType.UNSIGNED_8, 4), "color");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 3), "position");
- eb.add(Element.U32(rs), "#padding_1");
- return eb.create();
- }
-
- public ScriptField_Particle(RenderScript rs, int count) {
- mItemArray = null;
- mIOBuffer = null;
- mElement = createElement(rs);
- init(rs, count);
- }
-
- private void copyToArray(Item i, int index) {
- if (mIOBuffer == null) mIOBuffer = new FieldPacker(Item.sizeof * mType.getX() /* count */);
- mIOBuffer.reset(index * Item.sizeof);
- mIOBuffer.addU8(i.color);
- mIOBuffer.addF32(i.position);
- mIOBuffer.skip(4);
- }
-
- public void set(Item i, int index, boolean copyNow) {
- if (mItemArray == null) mItemArray = new Item[mType.getX() /* count */];
- mItemArray[index] = i;
- if (copyNow) {
- copyToArray(i, index);
- mAllocation.subData1D(index, 1, mIOBuffer.getData());
- }
-
- }
-
- public void copyAll() {
- for (int ct=0; ct < mItemArray.length; ct++) copyToArray(mItemArray[ct], ct);
- mAllocation.data(mIOBuffer.getData());
- }
-
-}
-
diff --git a/res/raw/galaxy.rs b/src/com/android/wallpaper/galaxy/galaxy.rs
index 00068a6..436b91d 100644
--- a/res/raw/galaxy.rs
+++ b/src/com/android/wallpaper/galaxy/galaxy.rs
@@ -16,9 +16,9 @@
#pragma rs java_package_name(com.android.wallpaper.galaxy)
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_types.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_math.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_graphics.rsh"
+#include "rs_types.rsh"
+#include "rs_math.rsh"
+#include "rs_graphics.rsh"
#pragma stateVertex(parent);
#pragma stateStore(parent);
diff --git a/src/com/android/wallpaper/grass/GrassRS.java b/src/com/android/wallpaper/grass/GrassRS.java
index 07abbdb..492ff8d 100644
--- a/src/com/android/wallpaper/grass/GrassRS.java
+++ b/src/com/android/wallpaper/grass/GrassRS.java
@@ -137,7 +137,7 @@ class GrassRS extends RenderScriptScene {
@Override
protected ScriptC createScript() {
- mScript = new ScriptC_Grass(mRS, mResources, R.raw.grass_bc, true);
+ mScript = new ScriptC_Grass(mRS, mResources, R.raw.grass, true);
final boolean isPreview = isPreview();
createProgramVertex();
diff --git a/src/com/android/wallpaper/grass/ScriptC_Grass.java b/src/com/android/wallpaper/grass/ScriptC_Grass.java
deleted file mode 100644
index 8b4877f..0000000
--- a/src/com/android/wallpaper/grass/ScriptC_Grass.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.grass;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptC_Grass extends ScriptC {
- // Constructor
- public ScriptC_Grass(RenderScript rs, Resources resources, int id, boolean isRoot) {
- super(rs, resources, id, isRoot);
- }
-
- private final static int mExportVarIdx_gBladesCount = 0;
- private int mExportVar_gBladesCount;
- public void set_gBladesCount(int v) {
- mExportVar_gBladesCount = v;
- setVar(mExportVarIdx_gBladesCount, v);
- }
-
- public int get_gBladesCount() {
- return mExportVar_gBladesCount;
- }
-
- private final static int mExportVarIdx_gIndexCount = 1;
- private int mExportVar_gIndexCount;
- public void set_gIndexCount(int v) {
- mExportVar_gIndexCount = v;
- setVar(mExportVarIdx_gIndexCount, v);
- }
-
- public int get_gIndexCount() {
- return mExportVar_gIndexCount;
- }
-
- private final static int mExportVarIdx_gWidth = 2;
- private int mExportVar_gWidth;
- public void set_gWidth(int v) {
- mExportVar_gWidth = v;
- setVar(mExportVarIdx_gWidth, v);
- }
-
- public int get_gWidth() {
- return mExportVar_gWidth;
- }
-
- private final static int mExportVarIdx_gHeight = 3;
- private int mExportVar_gHeight;
- public void set_gHeight(int v) {
- mExportVar_gHeight = v;
- setVar(mExportVarIdx_gHeight, v);
- }
-
- public int get_gHeight() {
- return mExportVar_gHeight;
- }
-
- private final static int mExportVarIdx_gXOffset = 4;
- private float mExportVar_gXOffset;
- public void set_gXOffset(float v) {
- mExportVar_gXOffset = v;
- setVar(mExportVarIdx_gXOffset, v);
- }
-
- public float get_gXOffset() {
- return mExportVar_gXOffset;
- }
-
- private final static int mExportVarIdx_gDawn = 5;
- private float mExportVar_gDawn;
- public void set_gDawn(float v) {
- mExportVar_gDawn = v;
- setVar(mExportVarIdx_gDawn, v);
- }
-
- public float get_gDawn() {
- return mExportVar_gDawn;
- }
-
- private final static int mExportVarIdx_gMorning = 6;
- private float mExportVar_gMorning;
- public void set_gMorning(float v) {
- mExportVar_gMorning = v;
- setVar(mExportVarIdx_gMorning, v);
- }
-
- public float get_gMorning() {
- return mExportVar_gMorning;
- }
-
- private final static int mExportVarIdx_gAfternoon = 7;
- private float mExportVar_gAfternoon;
- public void set_gAfternoon(float v) {
- mExportVar_gAfternoon = v;
- setVar(mExportVarIdx_gAfternoon, v);
- }
-
- public float get_gAfternoon() {
- return mExportVar_gAfternoon;
- }
-
- private final static int mExportVarIdx_gDusk = 8;
- private float mExportVar_gDusk;
- public void set_gDusk(float v) {
- mExportVar_gDusk = v;
- setVar(mExportVarIdx_gDusk, v);
- }
-
- public float get_gDusk() {
- return mExportVar_gDusk;
- }
-
- private final static int mExportVarIdx_gIsPreview = 9;
- private int mExportVar_gIsPreview;
- public void set_gIsPreview(int v) {
- mExportVar_gIsPreview = v;
- setVar(mExportVarIdx_gIsPreview, v);
- }
-
- public int get_gIsPreview() {
- return mExportVar_gIsPreview;
- }
-
- private final static int mExportVarIdx_gPVBackground = 10;
- private ProgramVertex mExportVar_gPVBackground;
- public void set_gPVBackground(ProgramVertex v) {
- mExportVar_gPVBackground = v;
- setVar(mExportVarIdx_gPVBackground, (v == null) ? 0 : v.getID());
- }
-
- public ProgramVertex get_gPVBackground() {
- return mExportVar_gPVBackground;
- }
-
- private final static int mExportVarIdx_gPFBackground = 11;
- private ProgramFragment mExportVar_gPFBackground;
- public void set_gPFBackground(ProgramFragment v) {
- mExportVar_gPFBackground = v;
- setVar(mExportVarIdx_gPFBackground, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_gPFBackground() {
- return mExportVar_gPFBackground;
- }
-
- private final static int mExportVarIdx_gPFGrass = 12;
- private ProgramFragment mExportVar_gPFGrass;
- public void set_gPFGrass(ProgramFragment v) {
- mExportVar_gPFGrass = v;
- setVar(mExportVarIdx_gPFGrass, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_gPFGrass() {
- return mExportVar_gPFGrass;
- }
-
- private final static int mExportVarIdx_gPSBackground = 13;
- private ProgramStore mExportVar_gPSBackground;
- public void set_gPSBackground(ProgramStore v) {
- mExportVar_gPSBackground = v;
- setVar(mExportVarIdx_gPSBackground, (v == null) ? 0 : v.getID());
- }
-
- public ProgramStore get_gPSBackground() {
- return mExportVar_gPSBackground;
- }
-
- private final static int mExportVarIdx_gTNight = 14;
- private Allocation mExportVar_gTNight;
- public void set_gTNight(Allocation v) {
- mExportVar_gTNight = v;
- setVar(mExportVarIdx_gTNight, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTNight() {
- return mExportVar_gTNight;
- }
-
- private final static int mExportVarIdx_gTSunset = 15;
- private Allocation mExportVar_gTSunset;
- public void set_gTSunset(Allocation v) {
- mExportVar_gTSunset = v;
- setVar(mExportVarIdx_gTSunset, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTSunset() {
- return mExportVar_gTSunset;
- }
-
- private final static int mExportVarIdx_gTSunrise = 16;
- private Allocation mExportVar_gTSunrise;
- public void set_gTSunrise(Allocation v) {
- mExportVar_gTSunrise = v;
- setVar(mExportVarIdx_gTSunrise, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTSunrise() {
- return mExportVar_gTSunrise;
- }
-
- private final static int mExportVarIdx_gTSky = 17;
- private Allocation mExportVar_gTSky;
- public void set_gTSky(Allocation v) {
- mExportVar_gTSky = v;
- setVar(mExportVarIdx_gTSky, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTSky() {
- return mExportVar_gTSky;
- }
-
- private final static int mExportVarIdx_gTAa = 18;
- private Allocation mExportVar_gTAa;
- public void set_gTAa(Allocation v) {
- mExportVar_gTAa = v;
- setVar(mExportVarIdx_gTAa, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTAa() {
- return mExportVar_gTAa;
- }
-
- private final static int mExportVarIdx_gBladesMesh = 19;
- private Mesh mExportVar_gBladesMesh;
- public void set_gBladesMesh(Mesh v) {
- mExportVar_gBladesMesh = v;
- setVar(mExportVarIdx_gBladesMesh, (v == null) ? 0 : v.getID());
- }
-
- public Mesh get_gBladesMesh() {
- return mExportVar_gBladesMesh;
- }
-
- private final static int mExportVarIdx_Blades = 20;
- private ScriptField_Blade mExportVar_Blades;
- public void bind_Blades(ScriptField_Blade v) {
- mExportVar_Blades = v;
- if(v == null) bindAllocation(null, mExportVarIdx_Blades);
- else bindAllocation(v.getAllocation(), mExportVarIdx_Blades);
- }
-
- public ScriptField_Blade get_Blades() {
- return mExportVar_Blades;
- }
-
- private final static int mExportVarIdx_Verticies = 21;
- private ScriptField_Vertex mExportVar_Verticies;
- public void bind_Verticies(ScriptField_Vertex v) {
- mExportVar_Verticies = v;
- if(v == null) bindAllocation(null, mExportVarIdx_Verticies);
- else bindAllocation(v.getAllocation(), mExportVarIdx_Verticies);
- }
-
- public ScriptField_Vertex get_Verticies() {
- return mExportVar_Verticies;
- }
-
- private final static int mExportFuncIdx_updateBlades = 0;
- public void invoke_updateBlades() {
- invoke(mExportFuncIdx_updateBlades);
- }
-
-}
-
diff --git a/src/com/android/wallpaper/grass/ScriptField_Blade.java b/src/com/android/wallpaper/grass/ScriptField_Blade.java
deleted file mode 100644
index 5ba0daf..0000000
--- a/src/com/android/wallpaper/grass/ScriptField_Blade.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.grass;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptField_Blade extends android.renderscript.Script.FieldBase {
- static public class Item {
- public static final int sizeof = 52;
-
- float angle;
- int size;
- float xPos;
- float yPos;
- float offset;
- float scale;
- float lengthX;
- float lengthY;
- float hardness;
- float h;
- float s;
- float b;
- float turbulencex;
-
- Item() {
- }
-
- }
-
- private Item mItemArray[];
- private FieldPacker mIOBuffer;
- public static Element createElement(RenderScript rs) {
- Element.Builder eb = new Element.Builder(rs);
- eb.add(Element.F32(rs), "angle");
- eb.add(Element.I32(rs), "size");
- eb.add(Element.F32(rs), "xPos");
- eb.add(Element.F32(rs), "yPos");
- eb.add(Element.F32(rs), "offset");
- eb.add(Element.F32(rs), "scale");
- eb.add(Element.F32(rs), "lengthX");
- eb.add(Element.F32(rs), "lengthY");
- eb.add(Element.F32(rs), "hardness");
- eb.add(Element.F32(rs), "h");
- eb.add(Element.F32(rs), "s");
- eb.add(Element.F32(rs), "b");
- eb.add(Element.F32(rs), "turbulencex");
- return eb.create();
- }
-
- public ScriptField_Blade(RenderScript rs, int count) {
- mItemArray = null;
- mIOBuffer = null;
- mElement = createElement(rs);
- init(rs, count);
- }
-
- private void copyToArray(Item i, int index) {
- if (mIOBuffer == null) mIOBuffer = new FieldPacker(Item.sizeof * mType.getX() /* count */);
- mIOBuffer.reset(index * Item.sizeof);
- mIOBuffer.addF32(i.angle);
- mIOBuffer.addI32(i.size);
- mIOBuffer.addF32(i.xPos);
- mIOBuffer.addF32(i.yPos);
- mIOBuffer.addF32(i.offset);
- mIOBuffer.addF32(i.scale);
- mIOBuffer.addF32(i.lengthX);
- mIOBuffer.addF32(i.lengthY);
- mIOBuffer.addF32(i.hardness);
- mIOBuffer.addF32(i.h);
- mIOBuffer.addF32(i.s);
- mIOBuffer.addF32(i.b);
- mIOBuffer.addF32(i.turbulencex);
- }
-
- public void set(Item i, int index, boolean copyNow) {
- if (mItemArray == null) mItemArray = new Item[mType.getX() /* count */];
- mItemArray[index] = i;
- if (copyNow) {
- copyToArray(i, index);
- mAllocation.subData1D(index, 1, mIOBuffer.getData());
- }
-
- }
-
- public void copyAll() {
- for (int ct=0; ct < mItemArray.length; ct++) copyToArray(mItemArray[ct], ct);
- mAllocation.data(mIOBuffer.getData());
- }
-
-}
-
diff --git a/src/com/android/wallpaper/grass/ScriptField_Vertex.java b/src/com/android/wallpaper/grass/ScriptField_Vertex.java
deleted file mode 100644
index ac9d74b..0000000
--- a/src/com/android/wallpaper/grass/ScriptField_Vertex.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.grass;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptField_Vertex extends android.renderscript.Script.FieldBase {
- static public class Item {
- public static final int sizeof = 20;
-
- Short4 color;
- Float2 position;
- Float2 texture0;
-
- Item() {
- color = new Short4();
- position = new Float2();
- texture0 = new Float2();
- }
-
- }
-
- private Item mItemArray[];
- private FieldPacker mIOBuffer;
- public static Element createElement(RenderScript rs) {
- Element.Builder eb = new Element.Builder(rs);
- eb.add(Element.createVector(rs, Element.DataType.UNSIGNED_8, 4), "color");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 2), "position");
- eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 2), "texture0");
- return eb.create();
- }
-
- public ScriptField_Vertex(RenderScript rs, int count) {
- mItemArray = null;
- mIOBuffer = null;
- mElement = createElement(rs);
- init(rs, count);
- }
-
- private void copyToArray(Item i, int index) {
- if (mIOBuffer == null) mIOBuffer = new FieldPacker(Item.sizeof * mType.getX() /* count */);
- mIOBuffer.reset(index * Item.sizeof);
- mIOBuffer.addU8(i.color);
- mIOBuffer.addF32(i.position);
- mIOBuffer.addF32(i.texture0);
- }
-
- public void set(Item i, int index, boolean copyNow) {
- if (mItemArray == null) mItemArray = new Item[mType.getX() /* count */];
- mItemArray[index] = i;
- if (copyNow) {
- copyToArray(i, index);
- mAllocation.subData1D(index, 1, mIOBuffer.getData());
- }
-
- }
-
- public void copyAll() {
- for (int ct=0; ct < mItemArray.length; ct++) copyToArray(mItemArray[ct], ct);
- mAllocation.data(mIOBuffer.getData());
- }
-
-}
-
diff --git a/res/raw/grass.rs b/src/com/android/wallpaper/grass/grass.rs
index ddf594e..9d8b51c 100644
--- a/res/raw/grass.rs
+++ b/src/com/android/wallpaper/grass/grass.rs
@@ -16,9 +16,9 @@
#pragma rs java_package_name(com.android.wallpaper.grass)
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_types.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_math.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_graphics.rsh"
+#include "rs_types.rsh"
+#include "rs_math.rsh"
+#include "rs_graphics.rsh"
#define RSID_BLADES_BUFFER 2
diff --git a/src/com/android/wallpaper/nexus/NexusRS.java b/src/com/android/wallpaper/nexus/NexusRS.java
index 8811b9c..9fb274a 100644
--- a/src/com/android/wallpaper/nexus/NexusRS.java
+++ b/src/com/android/wallpaper/nexus/NexusRS.java
@@ -80,7 +80,7 @@ class NexusRS extends RenderScriptScene {
@Override
protected ScriptC createScript() {
- mScript = new ScriptC_Nexus(mRS, mResources, R.raw.nexus_bc, true);
+ mScript = new ScriptC_Nexus(mRS, mResources, R.raw.nexus, true);
createProgramFragmentStore();
createProgramFragment();
diff --git a/src/com/android/wallpaper/nexus/ScriptC_Nexus.java b/src/com/android/wallpaper/nexus/ScriptC_Nexus.java
deleted file mode 100644
index d3fcd0b..0000000
--- a/src/com/android/wallpaper/nexus/ScriptC_Nexus.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.wallpaper.nexus;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptC_Nexus extends ScriptC {
- // Constructor
- public ScriptC_Nexus(RenderScript rs, Resources resources, int id, boolean isRoot) {
- super(rs, resources, id, isRoot);
- }
-
- private final static int mExportVarIdx_gIsPreview = 0;
- private int mExportVar_gIsPreview;
- public void set_gIsPreview(int v) {
- mExportVar_gIsPreview = v;
- setVar(mExportVarIdx_gIsPreview, v);
- }
-
- public int get_gIsPreview() {
- return mExportVar_gIsPreview;
- }
-
- private final static int mExportVarIdx_gXOffset = 1;
- private float mExportVar_gXOffset;
- public void set_gXOffset(float v) {
- mExportVar_gXOffset = v;
- setVar(mExportVarIdx_gXOffset, v);
- }
-
- public float get_gXOffset() {
- return mExportVar_gXOffset;
- }
-
- private final static int mExportVarIdx_gMode = 2;
- private int mExportVar_gMode;
- public void set_gMode(int v) {
- mExportVar_gMode = v;
- setVar(mExportVarIdx_gMode, v);
- }
-
- public int get_gMode() {
- return mExportVar_gMode;
- }
-
- private final static int mExportVarIdx_gPFTexture = 3;
- private ProgramFragment mExportVar_gPFTexture;
- public void set_gPFTexture(ProgramFragment v) {
- mExportVar_gPFTexture = v;
- setVar(mExportVarIdx_gPFTexture, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_gPFTexture() {
- return mExportVar_gPFTexture;
- }
-
- private final static int mExportVarIdx_gPSBlend = 4;
- private ProgramStore mExportVar_gPSBlend;
- public void set_gPSBlend(ProgramStore v) {
- mExportVar_gPSBlend = v;
- setVar(mExportVarIdx_gPSBlend, (v == null) ? 0 : v.getID());
- }
-
- public ProgramStore get_gPSBlend() {
- return mExportVar_gPSBlend;
- }
-
- private final static int mExportVarIdx_gPFTexture565 = 5;
- private ProgramFragment mExportVar_gPFTexture565;
- public void set_gPFTexture565(ProgramFragment v) {
- mExportVar_gPFTexture565 = v;
- setVar(mExportVarIdx_gPFTexture565, (v == null) ? 0 : v.getID());
- }
-
- public ProgramFragment get_gPFTexture565() {
- return mExportVar_gPFTexture565;
- }
-
- private final static int mExportVarIdx_gTBackground = 6;
- private Allocation mExportVar_gTBackground;
- public void set_gTBackground(Allocation v) {
- mExportVar_gTBackground = v;
- setVar(mExportVarIdx_gTBackground, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTBackground() {
- return mExportVar_gTBackground;
- }
-
- private final static int mExportVarIdx_gTPulse = 7;
- private Allocation mExportVar_gTPulse;
- public void set_gTPulse(Allocation v) {
- mExportVar_gTPulse = v;
- setVar(mExportVarIdx_gTPulse, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTPulse() {
- return mExportVar_gTPulse;
- }
-
- private final static int mExportVarIdx_gTGlow = 8;
- private Allocation mExportVar_gTGlow;
- public void set_gTGlow(Allocation v) {
- mExportVar_gTGlow = v;
- setVar(mExportVarIdx_gTGlow, (v == null) ? 0 : v.getID());
- }
-
- public Allocation get_gTGlow() {
- return mExportVar_gTGlow;
- }
-
- private final static int mExportFuncIdx_initPulses = 0;
- public void invoke_initPulses() {
- invoke(mExportFuncIdx_initPulses);
- }
-
- private final static int mExportFuncIdx_addTap = 1;
- public void invoke_addTap(int x, int y) {
- FieldPacker addTap_fp = new FieldPacker(8);
- addTap_fp.addI32(x);
- addTap_fp.addI32(y);
- invoke(mExportFuncIdx_addTap, addTap_fp);
- }
-
-}
-
diff --git a/res/raw/nexus.rs b/src/com/android/wallpaper/nexus/nexus.rs
index 70ada22..4dbe6db 100644
--- a/res/raw/nexus.rs
+++ b/src/com/android/wallpaper/nexus/nexus.rs
@@ -16,9 +16,9 @@
#pragma rs java_package_name(com.android.wallpaper.nexus)
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_types.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_math.rsh"
-#include "../../../../../frameworks/base/libs/rs/scriptc/rs_graphics.rsh"
+#include "rs_types.rsh"
+#include "rs_math.rsh"
+#include "rs_graphics.rsh"
#pragma stateVertex(parent)
#define MAX_PULSES 20