Methods Summary |
---|
public void | appendSourceParams(com.android.scenegraph.ShaderParam p)
mSourceParams.put(p.getParamName(), p);
// Possibly lift this restriction later
if (mField != null) {
throw new RuntimeException("Can't add source params to objects that are rendering");
}
|
ScriptField_Renderable_s | getRsField(android.renderscript.RenderScriptGL rs, android.content.res.Resources res)
if (mField != null) {
return mField;
}
updateFieldItem(rs);
updateTextures(rs);
mField = new ScriptField_Renderable_s(rs, 1);
mField.set(mData, 0, true);
return mField;
|
public Transform | getTransform()
return mTransform;
|
public void | resolveMeshData(android.renderscript.Mesh mesh)
mData.mesh = mesh;
if (mData.mesh == null) {
Log.v("DRAWABLE: ", "*** NO MESH *** " + mMeshName);
return;
}
int subIndexCount = mData.mesh.getPrimitiveCount();
if (subIndexCount == 1 || mMeshIndexName == null) {
mData.meshIndex = 0;
} else {
for (int i = 0; i < subIndexCount; i ++) {
if (mData.mesh.getIndexSetAllocation(i).getName().equals(mMeshIndexName)) {
mData.meshIndex = i;
break;
}
}
}
if (mField != null) {
mField.set(mData, 0, true);
}
|
public void | setCullType(int cull)
mData.cullType = cull;
|
public void | setMaterialName(java.lang.String name)
mMaterialName = name;
|
public void | setMesh(android.renderscript.Mesh mesh)
mData.mesh = mesh;
if (mField != null) {
mField.set_mesh(0, mData.mesh, true);
}
|
public void | setMesh(java.lang.String mesh, java.lang.String indexName)
mMeshName = mesh;
mMeshIndexName = indexName;
|
public void | setRenderState(RenderState renderState)
mRenderState = renderState;
if (mField != null) {
RenderScriptGL rs = SceneManager.getRS();
updateFieldItem(rs);
mField.set(mData, 0, true);
}
|
public void | setTransform(Transform t)
mTransform = t;
if (mField != null) {
RenderScriptGL rs = SceneManager.getRS();
updateFieldItem(rs);
mField.set(mData, 0, true);
}
|
public void | setVisible(boolean vis)
mData.cullType = vis ? 0 : 2;
if (mField != null) {
mField.set_cullType(0, mData.cullType, true);
}
|
void | updateFieldItem(android.renderscript.RenderScriptGL rs)
if (mRenderState == null) {
mRenderState = SceneManager.getDefaultState();
}
if (mTransform == null) {
mTransform = SceneManager.getDefaultTransform();
}
updateVertexConstants(rs);
updateFragmentConstants(rs);
mData.transformMatrix = mTransform.getRSData().getAllocation();
mData.name = getNameAlloc(rs);
mData.render_state = mRenderState.getRSData().getAllocation();
mData.bVolInitialized = 0;
|
void | updateFragmentConstants(android.renderscript.RenderScriptGL rs)
Allocation pfParams = null, fragmentConstants = null;
FragmentShader pf = mRenderState.mFragment;
if (pf != null && pf.getObjectConstants() != null) {
fragmentConstants = Allocation.createTyped(rs, pf.getObjectConstants());
Element fragmentConst = fragmentConstants.getType().getElement();
pfParams = ShaderParam.fillInParams(fragmentConst, mSourceParams,
mTransform).getAllocation();
}
mData.pf_const = fragmentConstants;
mData.pf_constParams = pfParams;
|
void | updateTextures(android.renderscript.RenderScriptGL rs)
Iterator<ShaderParam> allParamsIter = mSourceParams.values().iterator();
int paramIndex = 0;
while (allParamsIter.hasNext()) {
ShaderParam sp = allParamsIter.next();
if (sp instanceof TextureParam) {
TextureParam p = (TextureParam)sp;
TextureBase tex = p.getTexture();
if (tex != null) {
mData.pf_textures[paramIndex++] = tex.getRsData(false).getAllocation();
}
}
}
ProgramFragment pf = mRenderState.mFragment.mProgram;
mData.pf_num_textures = pf != null ? Math.min(pf.getTextureCount(), paramIndex) : 0;
if (mField != null) {
mField.set_pf_textures(0, mData.pf_textures, true);
mField.set_pf_num_textures(0, mData.pf_num_textures, true);
}
|
void | updateVertexConstants(android.renderscript.RenderScriptGL rs)
Allocation pvParams = null, vertexConstants = null;
VertexShader pv = mRenderState.mVertex;
if (pv != null && pv.getObjectConstants() != null) {
vertexConstants = Allocation.createTyped(rs, pv.getObjectConstants());
Element vertexConst = vertexConstants.getType().getElement();
pvParams = ShaderParam.fillInParams(vertexConst, mSourceParams,
mTransform).getAllocation();
}
mData.pv_const = vertexConstants;
mData.pv_constParams = pvParams;
|