1/* 2 * Copyright (C) 2011 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 17package com.android.scenegraph; 18 19import java.lang.Math; 20import java.util.ArrayList; 21 22import android.renderscript.Matrix4f; 23import android.util.Log; 24 25/** 26 * @hide 27 */ 28public class MatrixTransform extends Transform { 29 30 Matrix4f mLocalMatrix; 31 public MatrixTransform() { 32 mLocalMatrix = new Matrix4f(); 33 } 34 35 public void setMatrix(Matrix4f matrix) { 36 mLocalMatrix = matrix; 37 updateRSData(); 38 } 39 40 public Matrix4f getMatrix() { 41 return new Matrix4f(mLocalMatrix.getArray()); 42 } 43 44 void initLocalData() { 45 mTransformData.localMat = mLocalMatrix; 46 } 47 48 void updateRSData() { 49 if (mField == null) { 50 return; 51 } 52 mField.set_localMat(0, mLocalMatrix, false); 53 mField.set_isDirty(0, 1, true); 54 } 55} 56 57 58 59 60 61