00001 /* 00002 * Copyright 2014 Google Inc. All Rights Reserved. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef TANGO_GL_TRANSFORM_H_ 00018 #define TANGO_GL_TRANSFORM_H_ 00019 00020 #include "glm/glm.hpp" 00021 #include "glm/gtc/quaternion.hpp" 00022 00023 namespace tango_gl { 00024 class Transform { 00025 public: 00026 Transform(); 00027 virtual ~Transform(); 00028 00029 Transform(const Transform& other) = delete; 00030 const Transform& operator=(const Transform& rhs) = delete; 00031 00032 void SetPosition(const glm::vec3& position); 00033 glm::vec3 GetPosition() const; 00034 00035 void SetRotation(const glm::quat& rotation); 00036 glm::quat GetRotation() const; 00037 00038 void SetScale(const glm::vec3& scale); 00039 glm::vec3 GetScale() const; 00040 00041 void Translate(const glm::vec3& translation); 00042 00043 void SetTransformationMatrix(const glm::mat4& transform_mat); 00044 glm::mat4 GetTransformationMatrix() const; 00045 00046 void SetParent(Transform* transform); 00047 00048 const Transform* GetParent() const ; 00049 Transform* GetParent() ; 00050 00051 private: 00052 Transform* parent_; 00053 00054 glm::vec3 position_; 00055 glm::quat rotation_; 00056 glm::vec3 scale_; 00057 }; 00058 } // namespace tango_gl 00059 #endif // TANGO_GL_TRANSFORM_H_