.rs files are now built by the build system.

Change-Id: Iba28bed6cc05883a28a59b8dd0ff12e1bfbe0c04
This commit is contained in:
Ying Wang
2010-07-16 10:21:48 -07:00
parent 6e738552ea
commit bc8112fd6d
6 changed files with 5 additions and 152 deletions

View File

@@ -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

View File

@@ -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 {
}
}

View File

@@ -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);
}
}

View File

@@ -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());
}
}

View File

@@ -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;