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);
117 BoundingVolume mSceneAABB;
120 bool mMaterialLoaded;
122 Dali::Vector<Vector3> mPoints;
123 Dali::Vector<Vector2> mTextures;
124 Dali::Vector<Vector2> mTextures2;
125 Dali::Vector<Vector3> mNormals;
126 Dali::Vector<Vector3> mTangents;
127 Dali::Vector<Vector3> mBiTangents;
128 Dali::Vector<TriIndex> mTriangles;
130 void CalculateTangentArray(const Dali::Vector<Vector3>& vertex,
131 const Dali::Vector<Vector2>& texcoord,
132 Dali::Vector<TriIndex>& triangle,
133 Dali::Vector<Vector3>& normal,
134 Dali::Vector<Vector3>& tangent);
136 void CenterAndScale(bool center, Dali::Vector<Vector3>& points);
139 void CreateGeometryArray(Dali::Vector<Vertex> & vertices,
140 Dali::Vector<Vector2> & textures,
141 Dali::Vector<VertexExt> & verticesExt,
142 Dali::Vector<int> & indices);
148 } // namespace Internal
150 } // namespace Toolkit
157 #endif // __DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H__