FileDocCategorySizeDatePackage
LightBase.javaAPI DocAndroid 5.1 API2701Thu Mar 12 22:22:44 GMT 2015com.android.scenegraph

LightBase

public abstract class LightBase extends SceneGraphBase
hide

Fields Summary
static final int
RS_LIGHT_POINT
static final int
RS_LIGHT_DIRECTIONAL
ScriptField_Light_s
mField
ScriptField_Light_s.Item
mFieldData
Transform
mTransform
android.renderscript.Float4
mColor
float
mIntensity
Constructors Summary
public LightBase()

      
        mColor = new Float4(0.0f, 0.0f, 0.0f, 0.0f);
        mIntensity = 1.0f;
    
Methods Summary
ScriptField_Light_sgetRSData()

        if (mField != null) {
            return mField;
        }

        RenderScriptGL rs = SceneManager.getRS();
        if (rs == null) {
            return null;
        }
        if (mField == null) {
            mField = new ScriptField_Light_s(rs, 1);
            mFieldData = new ScriptField_Light_s.Item();
        }

        updateRSData();

        return mField;
    
abstract voidinitLocalData()

public voidsetColor(float r, float g, float b)

        mColor.x = r;
        mColor.y = g;
        mColor.z = b;
        updateRSData();
    
public voidsetColor(android.renderscript.Float3 c)

        setColor(c.x, c.y, c.z);
    
public voidsetIntensity(float i)

        mIntensity = i;
        updateRSData();
    
public voidsetName(java.lang.String n)

        super.setName(n);
        updateRSData();
    
public voidsetTransform(Transform t)

        mTransform = t;
        updateRSData();
    
protected voidupdateRSData()

        if (mField == null) {
            return;
        }
        RenderScriptGL rs = SceneManager.getRS();
        mFieldData.transformMatrix = mTransform.getRSData().getAllocation();
        mFieldData.name = getNameAlloc(rs);
        mFieldData.color = mColor;
        mFieldData.intensity = mIntensity;

        initLocalData();

        mField.set(mFieldData, 0, true);