1 #ifndef __DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H__
2 #define __DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/devel-api/rendering/renderer.h>
25 #include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
54 Vertex( const Vector3& position, const Vector3& normal, const Vector2& textureCoord )
55 : position( position ), normal( normal )
67 VertexExt( const Vector3& tangent, const Vector3& binormal )
68 : tangent( tangent), bitangent (binormal)
79 pointMin = Vector3(999999.9,999999.9,999999.9);
80 pointMax = Vector3(-999999.9,-999999.9,-999999.9);
83 void ConsiderNewPointInVolume(const Vector3& position)
85 pointMin.x = std::min(position.x, pointMin.x);
86 pointMin.y = std::min(position.y, pointMin.y);
87 pointMin.z = std::min(position.z, pointMin.z);
89 pointMax.x = std::max(position.x, pointMax.x);
90 pointMax.y = std::max(position.y, pointMax.y);
91 pointMax.z = std::max(position.z, pointMax.z);
101 bool IsSceneLoaded();
102 bool IsMaterialLoaded();
104 bool Load(char* objBuffer, std::streampos fileSize, std::string& materialFile);
106 void LoadMaterial(char* objBuffer, std::streampos fileSize, std::string& texture0Url, std::string& texture1Url, std::string& texture2Url);
108 Geometry CreateGeometry(Toolkit::Model3dView::IlluminationType illuminationType);
115 bool IsTexturePresent();
116 bool IsNormalMapPresent();
120 BoundingVolume mSceneAABB;
123 bool mMaterialLoaded;
127 Dali::Vector<Vector3> mPoints;
128 Dali::Vector<Vector2> mTextures;
129 Dali::Vector<Vector2> mTextures2;
130 Dali::Vector<Vector3> mNormals;
131 Dali::Vector<Vector3> mTangents;
132 Dali::Vector<Vector3> mBiTangents;
133 Dali::Vector<TriIndex> mTriangles;
135 void CalculateTangentArray(const Dali::Vector<Vector3>& vertex,
136 const Dali::Vector<Vector2>& texcoord,
137 Dali::Vector<TriIndex>& triangle,
138 Dali::Vector<Vector3>& normal,
139 Dali::Vector<Vector3>& tangent);
141 void CenterAndScale(bool center, Dali::Vector<Vector3>& points);
144 void CreateGeometryArray(Dali::Vector<Vertex> & vertices,
145 Dali::Vector<Vector2> & textures,
146 Dali::Vector<VertexExt> & verticesExt,
147 Dali::Vector<unsigned short> & indices);
153 } // namespace Internal
155 } // namespace Toolkit
162 #endif // __DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H__