1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.scenegraph; 18 19 import java.lang.Math; 20 21 import com.android.scenegraph.SceneManager; 22 23 import android.content.res.Resources; 24 import android.renderscript.*; 25 import android.util.Log; 26 27 /** 28 * @hide 29 */ 30 public class TextureRenderTarget extends TextureBase { TextureRenderTarget()31 public TextureRenderTarget() { 32 super(ScriptC_export.const_TextureType_TEXTURE_RENDER_TARGET); 33 } 34 TextureRenderTarget(Allocation tex)35 public TextureRenderTarget(Allocation tex) { 36 super(ScriptC_export.const_TextureType_TEXTURE_RENDER_TARGET); 37 setTexture(tex); 38 } 39 setTexture(Allocation tex)40 public void setTexture(Allocation tex) { 41 mData.texture = tex; 42 if (mField != null) { 43 mField.set_texture(0, mData.texture, true); 44 } 45 } 46 load()47 void load() { 48 } 49 getRsData(boolean loadNow)50 ScriptField_Texture_s getRsData(boolean loadNow) { 51 if (mField != null) { 52 return mField; 53 } 54 55 RenderScriptGL rs = SceneManager.getRS(); 56 if (rs == null) { 57 return null; 58 } 59 60 mField = new ScriptField_Texture_s(rs, 1); 61 mField.set(mData, 0, true); 62 return mField; 63 } 64 } 65 66 67 68 69 70