summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2009-11-10 16:14:22 -0800
committerMarco Nelissen <marcone@google.com>2009-11-11 09:49:17 -0800
commit100f6bf08f1153ea6f38776f52cc1dbc7683d867 (patch)
treebe6ab560e6f8441449995d4771bec78610fdce7a
parent423d39f6a9fd7b6399b92a272eadc49676375f48 (diff)
downloadandroid_packages_wallpapers_MagicSmoke-100f6bf08f1153ea6f38776f52cc1dbc7683d867.tar.gz
android_packages_wallpapers_MagicSmoke-100f6bf08f1153ea6f38776f52cc1dbc7683d867.tar.bz2
android_packages_wallpapers_MagicSmoke-100f6bf08f1153ea6f38776f52cc1dbc7683d867.zip
Add some more magic smoke, increase size of quads so the texture edges don't show.
-rw-r--r--res/raw/clouds.rs80
-rw-r--r--src/com/android/magicsmoke/MagicSmokeRS.java49
2 files changed, 94 insertions, 35 deletions
diff --git a/res/raw/clouds.rs b/res/raw/clouds.rs
index 515a281..a468cfb 100644
--- a/res/raw/clouds.rs
+++ b/res/raw/clouds.rs
@@ -45,13 +45,13 @@ void drawCloud(float *ident, int id, int idx) {
bindTexture(NAMED_PFBackground, 0, id);
drawQuadTexCoords(
- -600.0f, -600.0f, z, // space
+ -1200.0f, -1200.0f, z, // space
0.f + xshift[idx], 0.f, // texture
- 600, -600.0f, z, // space
+ 1200, -1200.0f, z, // space
scale[idx] + xshift[idx], 0.f, // texture
- 600, 600.0f, z, // space
+ 1200, 1200.0f, z, // space
scale[idx] + xshift[idx], scale[idx], // texture
- -600.0f, 600.0f, z, // space
+ -1200.0f, 1200.0f, z, // space
0.f + xshift[idx], scale[idx]); // texture
}
@@ -119,7 +119,7 @@ void makeTexture(int *src, int *dst, int rsid) {
int y;
int pm = State->mPreMul;
- if (State->mProcessTexture) {
+ if (State->mProcessTextureMode == 1) {
int lowcol = State->mLowCol;
int highcol = State->mHighCol;
@@ -147,7 +147,63 @@ void makeTexture(int *src, int *dst, int rsid) {
}
}
alphafactor *= State->mAlphaMul;
+ } else if (State->mProcessTextureMode == 2) {
+ int lowcol = State->mLowCol;
+ int highcol = State->mHighCol;
+ float scale = 255.f / (255.f - lowcol);
+
+ for (y=0;y<256;y++) {
+ for (x=0;x<256;x++) {
+ int pix = src[y*256+x];
+ int alpha = pix & 0x00ff;
+ if (alpha < lowcol) {
+ alpha = 0;
+ } else {
+ alpha = (alpha - lowcol) * scale;
+ }
+ alpha /= alphafactor;
+ int newpix = highcol;
+ if (pm) newpix = premul(newpix, alpha);
+ newpix = newpix | (alpha << 24);
+ // have ARGB, need ABGR
+ newpix = (newpix & 0xff00ff00) | ((newpix & 0xff) << 16) | ((newpix >> 16) & 0xff);
+ dst[y*256+x] = newpix;
+ }
+ }
+ alphafactor *= State->mAlphaMul;
+ } else if (State->mProcessTextureMode == 3) {
+ int lowcol = State->mLowCol;
+ int highcol = State->mHighCol;
+ float scale = 255.f / (255.f - lowcol);
+
+ for (y=0;y<256;y++) {
+ for (x=0;x<256;x++) {
+ int pix = src[y*256+x];
+ int lum = pix & 0x00ff;
+ int newpix;
+ if (lum < 128) lum *= 2;
+ else lum = (255 - (lum - 128) * 2);
+ if (lum < 128) {
+ newpix = lowcol;
+ int newalpha = 255 - (lum * 2);
+ newalpha /= alphafactor;
+ if (pm) newpix = premul(newpix, newalpha);
+ newpix = newpix | (newalpha << 24);
+ } else {
+ newpix = highcol;
+ int newalpha = (lum - 128) * 2;
+ newalpha /= alphafactor;
+ if (pm) newpix = premul(newpix, newalpha);
+ newpix = newpix | (newalpha << 24);
+ }
+ // have ARGB, need ABGR
+ newpix = (newpix & 0xff00ff00) | ((newpix & 0xff) << 16) | ((newpix >> 16) & 0xff);
+ dst[y*256+x] = newpix;
+ }
+ }
+ alphafactor *= State->mAlphaMul;
} else {
+
for (y=0;y<256;y++) {
for (x=0;x<256;x++) {
int rgb = *src++;
@@ -187,11 +243,11 @@ void init() {
xshift[i] = 0.f;
rotation[i] = 360.f * i / 5.f;
}
- scale[0] = 2.f; // changed below based on preset
- scale[1] = 1.5f;
- scale[2] = 1.7f;
- scale[3] = 1.9f;
- scale[4] = 2.1f;
+ scale[0] = 4.0f; // changed below based on preset
+ scale[1] = 3.0f;
+ scale[2] = 3.4f;
+ scale[3] = 3.8f;
+ scale[4] = 4.2f;
currentpreset = -1;
}
@@ -226,9 +282,9 @@ int main(int launchID) {
}
if (State->mTextureSwap != 0) {
- scale[0] = .125f;
+ scale[0] = .25f;
} else {
- scale[0] = 2.f;
+ scale[0] = 4.f;
}
drawClouds(ident);
diff --git a/src/com/android/magicsmoke/MagicSmokeRS.java b/src/com/android/magicsmoke/MagicSmokeRS.java
index 726d128..ce969fe 100644
--- a/src/com/android/magicsmoke/MagicSmokeRS.java
+++ b/src/com/android/magicsmoke/MagicSmokeRS.java
@@ -58,7 +58,7 @@ class MagicSmokeRS extends RenderScriptScene implements OnSharedPreferenceChange
public int mTextureMask;
public int mRotate;
public int mTextureSwap;
- public int mProcessTexture;
+ public int mProcessTextureMode;
public int mBackCol;
public int mLowCol;
public int mHighCol;
@@ -97,9 +97,9 @@ class MagicSmokeRS extends RenderScriptScene implements OnSharedPreferenceChange
private SharedPreferences mSharedPref;
static class Preset {
- Preset(boolean process, int backcol, int locol, int hicol, float mul, int mask,
+ Preset(int processmode, int backcol, int locol, int hicol, float mul, int mask,
boolean rot, int blend, boolean texswap, boolean premul) {
- mProcessTexture = process;
+ mProcessTextureMode = processmode;
mBackColor = backcol;
mLowColor = locol;
mHighColor = hicol;
@@ -110,7 +110,7 @@ class MagicSmokeRS extends RenderScriptScene implements OnSharedPreferenceChange
mTextureSwap = texswap;
mPreMul = premul;
}
- public boolean mProcessTexture;
+ public int mProcessTextureMode;
public int mBackColor;
public int mLowColor;
public int mHighColor;
@@ -124,24 +124,27 @@ class MagicSmokeRS extends RenderScriptScene implements OnSharedPreferenceChange
public static final int DEFAULT_PRESET = 4;
public static final Preset [] mPreset = new Preset[] {
- // proc back low high alph mask rot blend swap premul
- new Preset(true, 0x000000, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
- new Preset(true, 0x0000ff, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
- new Preset(true, 0x00ff00, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
- new Preset(true, 0x00ff00, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, true),
- new Preset(true, 0x00ff00, 0x00ff00, 0xffffff, 2.5f, 0x1f, true, 0, true, true),
- new Preset(true, 0x800000, 0xff0000, 0xffffff, 2.5f, 0x1f, true, 0, true, false),
- new Preset(false, 0x000000, 0x000000, 0xffffff, 0.0f, 0x1f, true, 0, false, false),
- new Preset(true, 0x0000ff, 0x00ff00, 0xffff00, 2.0f, 0x1f, true, 0, true, false),
- new Preset(true, 0x008000, 0x00ff00, 0xffffff, 2.5f, 0x1f, true, 0, true, false),
- new Preset(true, 0x800000, 0xff0000, 0xffffff, 2.5f, 0x1f, true, 0, true, true),
- new Preset(true, 0x808080, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, true),
- new Preset(true, 0x0000ff, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, true),
- new Preset(true, 0x0000ff, 0x00ff00, 0xffff00, 1.5f, 0x1f, false, 0, false, true),
- new Preset(true, 0x0000ff, 0x00ff00, 0xffff00, 2.0f, 0x1f, true, 0, true, true),
- new Preset(true, 0x0000ff, 0x00ff00, 0xffff00, 1.5f, 0x1f, true, 0, true, true),
- new Preset(true, 0x808080, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
- new Preset(true, 0x000000, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, true, false),
+ // proc back low high alph mask rot blend swap premul
+ new Preset(1, 0x000000, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
+ new Preset(1, 0x0000ff, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
+ new Preset(1, 0x00ff00, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
+ new Preset(1, 0x00ff00, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, true),
+ new Preset(1, 0x00ff00, 0x00ff00, 0xffffff, 2.5f, 0x1f, true, 0, true, true),
+ new Preset(1, 0x800000, 0xff0000, 0xffffff, 2.5f, 0x1f, true, 0, true, false),
+ new Preset(0, 0x000000, 0x000000, 0xffffff, 0.0f, 0x1f, true, 0, false, false),
+ new Preset(1, 0x0000ff, 0x00ff00, 0xffff00, 2.0f, 0x1f, true, 0, true, false),
+ new Preset(1, 0x008000, 0x00ff00, 0xffffff, 2.5f, 0x1f, true, 0, true, false),
+ new Preset(1, 0x800000, 0xff0000, 0xffffff, 2.5f, 0x1f, true, 0, true, true),
+ new Preset(1, 0x808080, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, true),
+ new Preset(1, 0x0000ff, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, true),
+ new Preset(1, 0x0000ff, 0x00ff00, 0xffff00, 1.5f, 0x1f, false, 0, false, true),
+ new Preset(1, 0x0000ff, 0x00ff00, 0xffff00, 2.0f, 0x1f, true, 0, true, true),
+ new Preset(1, 0x0000ff, 0x00ff00, 0xffff00, 1.5f, 0x1f, true, 0, true, true),
+ new Preset(1, 0x808080, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, false, false),
+ new Preset(1, 0x000000, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, true, false),
+ new Preset(2, 0x000000, 0x000070, 0xff2020, 2.5f, 0x1f, true, 0, false, false),
+ new Preset(2, 0x6060ff, 0x000070, 0xffffff, 2.5f, 0x1f, true, 0, false, false),
+ new Preset(3, 0x0000f0, 0x000000, 0xffffff, 2.0f, 0x0f, true, 0, true, false),
};
private float mTouchY;
@@ -171,7 +174,7 @@ class MagicSmokeRS extends RenderScriptScene implements OnSharedPreferenceChange
mWorldState.mTextureMask = mPreset[p].mTextureMask;
mWorldState.mRotate = mPreset[p].mRotate ? 1 : 0;
mWorldState.mTextureSwap = mPreset[p].mTextureSwap ? 1 : 0;
- mWorldState.mProcessTexture = mPreset[p].mProcessTexture ? 1 : 0;
+ mWorldState.mProcessTextureMode = mPreset[p].mProcessTextureMode;
mWorldState.mBackCol = mPreset[p].mBackColor;
mWorldState.mLowCol = mPreset[p].mLowColor;
mWorldState.mHighCol = mPreset[p].mHighColor;