From bc8112fd6db905aa02b86bc73c2a4086c89253d1 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 16 Jul 2010 10:21:48 -0700 Subject: [PATCH] .rs files are now built by the build system. Change-Id: Iba28bed6cc05883a28a59b8dd0ff12e1bfbe0c04 --- libs/rs/java/Fountain/Android.mk | 2 +- libs/rs/java/Fountain/res/raw/fountain_bc.bc | Bin 2996 -> 0 bytes .../src/com/android/fountain/FountainRS.java | 4 +- .../android/fountain/ScriptC_Fountain.java | 65 -------------- .../android/fountain/ScriptField_Point.java | 80 ------------------ .../{ => com/android/fountain}/fountain.rs | 6 +- 6 files changed, 5 insertions(+), 152 deletions(-) delete mode 100644 libs/rs/java/Fountain/res/raw/fountain_bc.bc delete mode 100644 libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java delete mode 100644 libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java rename libs/rs/java/Fountain/src/{ => com/android/fountain}/fountain.rs (92%) diff --git a/libs/rs/java/Fountain/Android.mk b/libs/rs/java/Fountain/Android.mk index f7e53a8f1244e..814d2ae27d489 100644 --- a/libs/rs/java/Fountain/Android.mk +++ b/libs/rs/java/Fountain/Android.mk @@ -19,7 +19,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional -LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) #LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript LOCAL_PACKAGE_NAME := Fountain diff --git a/libs/rs/java/Fountain/res/raw/fountain_bc.bc b/libs/rs/java/Fountain/res/raw/fountain_bc.bc deleted file mode 100644 index 2c8ce8b9c6fb729d9822a495f0ca5d57de1b41eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2996 zcmZ8j4OA0X7JidVG6PJ)!~{B#024sURp5-Tne)B- z?z{KC`{sUc<{9#RA1es}KH~v^kN_+I0AS6@9r_WpP)KGh>qMNyA^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jodWv7F*8imZBL&Pw>u#M(t0+y>hwPyqb z)n326(jlqv2!SeAau6Mo$k}DCEQ`aYvJ>L~Y>9Bb!FwZn)(L8=RbQ+#)-1pk!EC2q z0jsl##(bRSjG`?EmzZ{d;UsoneAQ=dBYv29!?-PP$y+K6G%aFTsrjqZ>^FROSj9Q~(OGZIvH4W=0#k{%{< zKED7zGA8mbv@w#|ql~fWLbCn3Ma3zguUed3Z`lP@st$}hY4fRfPuzamOMne&0Q5E7xW>M@8Xs~+d%>ec)U z_)`YRkyj(s>JMxygcpbyQtpAFYG+(f-@hSJt&XnFiX;nwi+JUQjlO2t|LVy0Z_;!! zgvuzZuU_Ju)VzE>Wj^_<$Nd!KW>&S{1=6Edzskk2UmJ$`AD;M-!)vKKG<(={|^@51CcQ5KS%d3+)hK@px-#THHnKQ}D@hKlRr#m72-{+LaS$C8|sIPlQ=`usj97pXX*;WZiat%6JT(wkIcsIlShAW}Opv zIC*BPYCZN2`HxABBN5mQgm4@B(hfQ*jGbo>JfT+aZI4?6@zlg>h@){ahO&_q?I_wS#w(q}SUzJkkHnP>VM$0**` zcuJFbX11j{%jJ7IM>rZ(w<7Yga$HfrB@|TT%MT*^D@ifDzsOwj=8%- z5r>Dzm6F8wt3i$8BKyHVHpLQzA@)oL!UZ8QLC*k{*hoGq1nBt?EA9I9TjyF=76*AR>$p3XC0;cN^8!P z4@wJZ^)u(DaGz7#{tJ~))uYoW2My+@LdH)25|re~lIqFRX*l6d&AquL+O<~EM=LKs zpYj^(t%1rnhvxFGmEPUhJ@nNF$DNv%_@a)UCA*V>bV@_3ci_@E^m=08YjP}_$d5Ei VlhU0P#MzafcMR}GEpQXC{U5l-1`q%M diff --git a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java index cfe8e27aeecb7..3cfb457b89643 100644 --- a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java +++ b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java @@ -41,7 +41,7 @@ public class FountainRS { smb.addIndexType(Primitive.POINT); Mesh sm = smb.create(); - mScript = new ScriptC_Fountain(mRS, mRes, R.raw.fountain_bc, true); + mScript = new ScriptC_Fountain(mRS, mRes, R.raw.fountain, true); mScript.set_partMesh(sm); mScript.bind_point(points); mRS.contextBindRootScript(mScript); @@ -65,5 +65,3 @@ public class FountainRS { } } - - diff --git a/libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java b/libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java deleted file mode 100644 index 0ec00096f525e..0000000000000 --- a/libs/rs/java/Fountain/src/com/android/fountain/ScriptC_Fountain.java +++ /dev/null @@ -1,65 +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.fountain; - -import android.renderscript.*; -import android.content.res.Resources; -import android.util.Log; - -public class ScriptC_Fountain extends ScriptC { - // Constructor - public ScriptC_Fountain(RenderScript rs, Resources resources, int id, boolean isRoot) { - super(rs, resources, id, isRoot); - } - - private final static int mExportVarIdx_partMesh = 0; - private Mesh mExportVar_partMesh; - public void set_partMesh(Mesh v) { - mExportVar_partMesh = v; - setVar(mExportVarIdx_partMesh, (v == null) ? 0 : v.getID()); - } - - public Mesh get_partMesh() { - return mExportVar_partMesh; - } - - private final static int mExportVarIdx_point = 1; - private ScriptField_Point mExportVar_point; - public void bind_point(ScriptField_Point v) { - mExportVar_point = v; - if(v == null) bindAllocation(null, mExportVarIdx_point); - else bindAllocation(v.getAllocation(), mExportVarIdx_point); - } - - public ScriptField_Point get_point() { - return mExportVar_point; - } - - private final static int mExportFuncIdx_addParticles = 0; - public void invoke_addParticles(int rate, float x, float y, int index, boolean newColor) { - FieldPacker addParticles_fp = new FieldPacker(20); - addParticles_fp.addI32(rate); - addParticles_fp.addF32(x); - addParticles_fp.addF32(y); - addParticles_fp.addI32(index); - addParticles_fp.addBoolean(newColor); - addParticles_fp.skip(3); - invoke(mExportFuncIdx_addParticles, addParticles_fp); - } - -} - diff --git a/libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java b/libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java deleted file mode 100644 index d88f47b6b3a70..0000000000000 --- a/libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.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.fountain; - -import android.renderscript.*; -import android.content.res.Resources; -import android.util.Log; - -public class ScriptField_Point extends android.renderscript.Script.FieldBase { - static public class Item { - public static final int sizeof = 20; - - Float2 delta; - Float2 position; - Short4 color; - - Item() { - delta = new Float2(); - position = new Float2(); - color = new Short4(); - } - - } - - 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.FLOAT_32, 2), "delta"); - eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 2), "position"); - eb.add(Element.createVector(rs, Element.DataType.UNSIGNED_8, 4), "color"); - return eb.create(); - } - - public ScriptField_Point(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.delta); - mIOBuffer.addF32(i.position); - mIOBuffer.addU8(i.color); - } - - 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/libs/rs/java/Fountain/src/fountain.rs b/libs/rs/java/Fountain/src/com/android/fountain/fountain.rs similarity index 92% rename from libs/rs/java/Fountain/src/fountain.rs rename to libs/rs/java/Fountain/src/com/android/fountain/fountain.rs index e3b85e8ff845c..4417197f5fdd1 100644 --- a/libs/rs/java/Fountain/src/fountain.rs +++ b/libs/rs/java/Fountain/src/com/android/fountain/fountain.rs @@ -3,9 +3,9 @@ #pragma rs java_package_name(com.android.fountain) -#include "../../../scriptc/rs_types.rsh" -#include "../../../scriptc/rs_math.rsh" -#include "../../../scriptc/rs_graphics.rsh" +#include "rs_types.rsh" +#include "rs_math.rsh" +#include "rs_graphics.rsh" static int newPart = 0; rs_mesh partMesh;