Float4Parampublic class Float4Param extends ShaderParam
Fields Summary |
---|
private static String | TAG | LightBase | mLight |
Constructors Summary |
---|
public Float4Param(String name)
super(name);
| public Float4Param(String name, float x)
super(name);
set(x, 0, 0, 0);
| public Float4Param(String name, float x, float y)
super(name);
set(x, y, 0, 0);
| public Float4Param(String name, float x, float y, float z)
super(name);
set(x, y, z, 0);
| public Float4Param(String name, float x, float y, float z, float w)
super(name);
set(x, y, z, w);
|
Methods Summary |
---|
boolean | findLight(java.lang.String property)
String indexStr = mParamName.substring(property.length() + 1);
if (indexStr == null) {
Log.e(TAG, "Invalid light index.");
return false;
}
int index = Integer.parseInt(indexStr);
if (index == -1) {
return false;
}
Scene parentScene = SceneManager.getInstance().getActiveScene();
ArrayList<LightBase> allLights = parentScene.getLights();
if (index >= allLights.size()) {
return false;
}
mLight = allLights.get(index);
if (mLight == null) {
return false;
}
return true;
| int | getTypeFromName()
int paramType = ScriptC_export.const_ShaderParam_FLOAT4_DATA;
if (mParamName.equalsIgnoreCase(cameraPos)) {
paramType = ScriptC_export.const_ShaderParam_FLOAT4_CAMERA_POS;
} else if(mParamName.equalsIgnoreCase(cameraDir)) {
paramType = ScriptC_export.const_ShaderParam_FLOAT4_CAMERA_DIR;
} else if(mParamName.startsWith(lightColor) && findLight(lightColor)) {
paramType = ScriptC_export.const_ShaderParam_FLOAT4_LIGHT_COLOR;
} else if(mParamName.startsWith(lightPos) && findLight(lightPos)) {
paramType = ScriptC_export.const_ShaderParam_FLOAT4_LIGHT_POS;
} else if(mParamName.startsWith(lightDir) && findLight(lightDir)) {
paramType = ScriptC_export.const_ShaderParam_FLOAT4_LIGHT_DIR;
}
return paramType;
| public android.renderscript.Float4 | getValue()
return mData.float_value;
| void | initLocalData()
mData.type = getTypeFromName();
if (mCamera != null) {
mData.camera = mCamera.getRSData().getAllocation();
}
if (mLight != null) {
mData.light = mLight.getRSData().getAllocation();
}
| void | set(float x, float y, float z, float w)
mData.float_value.x = x;
mData.float_value.y = y;
mData.float_value.z = z;
mData.float_value.w = w;
if (mField != null) {
mField.set_float_value(0, mData.float_value, true);
}
incTimestamp();
| public void | setLight(LightBase l)
mLight = l;
if (mField != null) {
mData.light = mLight.getRSData().getAllocation();
mField.set_light(0, mData.light, true);
}
incTimestamp();
| public void | setValue(android.renderscript.Float4 v)
set(v.x, v.y, v.z, v.w);
|
|