Yingying Wang %!s(int64=5) %!d(string=hai) anos
pai
achega
b8e39b58d1

+ 2 - 5
code/AssetLib/glTF2/glTF2Asset.h

@@ -367,7 +367,7 @@ struct Object {
 //! An accessor provides a typed view into a BufferView or a subset of a BufferView
 //! An accessor provides a typed view into a BufferView or a subset of a BufferView
 //! similar to how WebGL's vertexAttribPointer() defines an attribute in a buffer.
 //! similar to how WebGL's vertexAttribPointer() defines an attribute in a buffer.
 struct Accessor : public Object {
 struct Accessor : public Object {
-    struct Sparse; //wangyi 0506
+    struct Sparse;
     Ref<BufferView> bufferView; //!< The ID of the bufferView. (required)
     Ref<BufferView> bufferView; //!< The ID of the bufferView. (required)
     size_t byteOffset; //!< The offset relative to the start of the bufferView in bytes. (required)
     size_t byteOffset; //!< The offset relative to the start of the bufferView in bytes. (required)
     ComponentType componentType; //!< The datatype of components in the attribute. (required)
     ComponentType componentType; //!< The datatype of components in the attribute. (required)
@@ -375,7 +375,7 @@ struct Accessor : public Object {
     AttribType::Value type; //!< Specifies if the attribute is a scalar, vector, or matrix. (required)
     AttribType::Value type; //!< Specifies if the attribute is a scalar, vector, or matrix. (required)
     std::vector<double> max; //!< Maximum value of each component in this attribute.
     std::vector<double> max; //!< Maximum value of each component in this attribute.
     std::vector<double> min; //!< Minimum value of each component in this attribute.
     std::vector<double> min; //!< Minimum value of each component in this attribute.
-    std::unique_ptr<Sparse> sparse; //wangyi 0506
+    std::unique_ptr<Sparse> sparse;
 
 
     unsigned int GetNumComponents();
     unsigned int GetNumComponents();
     unsigned int GetBytesPerComponent();
     unsigned int GetBytesPerComponent();
@@ -387,7 +387,6 @@ struct Accessor : public Object {
     void ExtractData(T *&outData);
     void ExtractData(T *&outData);
 
 
     void WriteData(size_t count, const void *src_buffer, size_t src_stride);
     void WriteData(size_t count, const void *src_buffer, size_t src_stride);
-    //wangyi 0506
     void WriteSparseValues(size_t count, const void *src_data, size_t src_dataStride);
     void WriteSparseValues(size_t count, const void *src_data, size_t src_dataStride);
     void WriteSparseIndices(size_t count, const void *src_idx, size_t src_idxStride);
     void WriteSparseIndices(size_t count, const void *src_idx, size_t src_idxStride);
 
 
@@ -430,7 +429,6 @@ struct Accessor : public Object {
     Accessor() {}
     Accessor() {}
     void Read(Value &obj, Asset &r);
     void Read(Value &obj, Asset &r);
 
 
-    //wangyi 0506
     //sparse
     //sparse
     struct Sparse {
     struct Sparse {
         size_t count;
         size_t count;
@@ -577,7 +575,6 @@ struct BufferView : public Object {
     BufferViewTarget target; //! The target that the WebGL buffer should be bound to.
     BufferViewTarget target; //! The target that the WebGL buffer should be bound to.
 
 
     void Read(Value &obj, Asset &r);
     void Read(Value &obj, Asset &r);
-    //wangyi 0506
     uint8_t *GetPointer(size_t accOffset);
     uint8_t *GetPointer(size_t accOffset);
 };
 };
 
 

+ 1 - 9
code/AssetLib/glTF2/glTF2Asset.inl

@@ -550,7 +550,6 @@ inline void BufferView::Read(Value &obj, Asset &r) {
     byteStride = MemberOrDefault(obj, "byteStride", 0u);
     byteStride = MemberOrDefault(obj, "byteStride", 0u);
 }
 }
 
 
-//wangyi 0506
 inline uint8_t *BufferView::GetPointer(size_t accOffset) {
 inline uint8_t *BufferView::GetPointer(size_t accOffset) {
     if (!buffer) return 0;
     if (!buffer) return 0;
     uint8_t *basePtr = buffer->GetPointer();
     uint8_t *basePtr = buffer->GetPointer();
@@ -571,7 +570,6 @@ inline uint8_t *BufferView::GetPointer(size_t accOffset) {
 // struct Accessor
 // struct Accessor
 //
 //
 
 
-//wangyi 0506
 inline void Accessor::Sparse::PopulateData(size_t numBytes, uint8_t *bytes) {
 inline void Accessor::Sparse::PopulateData(size_t numBytes, uint8_t *bytes) {
     if (bytes) {
     if (bytes) {
         data.assign(bytes, bytes + numBytes);
         data.assign(bytes, bytes + numBytes);
@@ -610,7 +608,7 @@ inline void Accessor::Sparse::PatchData(unsigned int elementSize) {
         pIndices += indexSize;
         pIndices += indexSize;
     }
     }
 }
 }
-// wangyi 0506
+
 inline void Accessor::Read(Value &obj, Asset &r) {
 inline void Accessor::Read(Value &obj, Asset &r) {
 
 
     if (Value *bufferViewVal = FindUInt(obj, "bufferView")) {
     if (Value *bufferViewVal = FindUInt(obj, "bufferView")) {
@@ -624,7 +622,6 @@ inline void Accessor::Read(Value &obj, Asset &r) {
     const char *typestr;
     const char *typestr;
     type = ReadMember(obj, "type", typestr) ? AttribType::FromString(typestr) : AttribType::SCALAR;
     type = ReadMember(obj, "type", typestr) ? AttribType::FromString(typestr) : AttribType::SCALAR;
 
 
-    //wangyi 0506
     if (Value *sparseValue = FindObject(obj, "sparse")) {
     if (Value *sparseValue = FindObject(obj, "sparse")) {
         sparse.reset(new Sparse);
         sparse.reset(new Sparse);
         // count
         // count
@@ -674,7 +671,6 @@ inline unsigned int Accessor::GetElementSize() {
     return GetNumComponents() * GetBytesPerComponent();
     return GetNumComponents() * GetBytesPerComponent();
 }
 }
 
 
-// wangyi 0506
 inline uint8_t *Accessor::GetPointer() {
 inline uint8_t *Accessor::GetPointer() {
     if (sparse)
     if (sparse)
         return sparse->data.data();
         return sparse->data.data();
@@ -732,8 +728,6 @@ void Accessor::ExtractData(T *&outData)
 
 
     const size_t targetElemSize = sizeof(T);
     const size_t targetElemSize = sizeof(T);
     ai_assert(elemSize <= targetElemSize);
     ai_assert(elemSize <= targetElemSize);
-
-    //wangyi 0506
     ai_assert(count * stride <= (bufferView ? bufferView->byteLength : sparse->data.size()));
     ai_assert(count * stride <= (bufferView ? bufferView->byteLength : sparse->data.size()));
 
 
     outData = new T[count];
     outData = new T[count];
@@ -759,7 +753,6 @@ inline void Accessor::WriteData(size_t _count, const void *src_buffer, size_t sr
     CopyData(_count, src, src_stride, dst, dst_stride);
     CopyData(_count, src, src_stride, dst, dst_stride);
 }
 }
 
 
-//wangyi 0506
 inline void Accessor::WriteSparseValues(size_t _count, const void *src_data, size_t src_dataStride) {
 inline void Accessor::WriteSparseValues(size_t _count, const void *src_data, size_t src_dataStride) {
     if (!sparse)
     if (!sparse)
         return;
         return;
@@ -774,7 +767,6 @@ inline void Accessor::WriteSparseValues(size_t _count, const void *src_data, siz
     CopyData(_count, value_src, src_dataStride, value_dst, value_dst_stride);
     CopyData(_count, value_src, src_dataStride, value_dst, value_dst_stride);
 }
 }
 
 
-//wangyi 0506
 inline void Accessor::WriteSparseIndices(size_t _count, const void *src_idx, size_t src_idxStride) {
 inline void Accessor::WriteSparseIndices(size_t _count, const void *src_idx, size_t src_idxStride) {
     if (!sparse)
     if (!sparse)
         return;
         return;

+ 0 - 2
code/AssetLib/glTF2/glTF2AssetWriter.inl

@@ -107,7 +107,6 @@ namespace glTF2 {
 
 
     inline void Write(Value& obj, Accessor& a, AssetWriter& w)
     inline void Write(Value& obj, Accessor& a, AssetWriter& w)
     {
     {
-        //wangyi 0506
         if (a.bufferView) {
         if (a.bufferView) {
             obj.AddMember("bufferView", a.bufferView->index, w.mAl);
             obj.AddMember("bufferView", a.bufferView->index, w.mAl);
             obj.AddMember("byteOffset", (unsigned int)a.byteOffset, w.mAl);
             obj.AddMember("byteOffset", (unsigned int)a.byteOffset, w.mAl);
@@ -125,7 +124,6 @@ namespace glTF2 {
         obj.AddMember("count", (unsigned int)a.count, w.mAl);
         obj.AddMember("count", (unsigned int)a.count, w.mAl);
         obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
         obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
 
 
-		// wangyi 0506
         if (a.sparse) {
         if (a.sparse) {
             Value sparseValue;
             Value sparseValue;
             sparseValue.SetObject();
             sparseValue.SetObject();

+ 9 - 10
code/AssetLib/glTF2/glTF2Exporter.cpp

@@ -207,7 +207,6 @@ inline void SetAccessorRange(ComponentType compType, Ref<Accessor> acc, void* da
 	}
 	}
 }
 }
 
 
-// wangyi 0506
 // compute the (data-dataBase), store the non-zero data items
 // compute the (data-dataBase), store the non-zero data items
 template <typename T>
 template <typename T>
 size_t NZDiff(void *data, void *dataBase, size_t count, unsigned int numCompsIn, unsigned int numCompsOut, void *&outputNZDiff, void *&outputNZIdx) {
 size_t NZDiff(void *data, void *dataBase, size_t count, unsigned int numCompsIn, unsigned int numCompsOut, void *&outputNZDiff, void *&outputNZIdx) {
@@ -271,7 +270,7 @@ inline size_t NZDiff(ComponentType compType, void *data, void *dataBase, size_t
     }
     }
     return 0;
     return 0;
 }
 }
-// wangyi 0506
+
 inline Ref<Accessor> ExportDataSparse(Asset &a, std::string &meshName, Ref<Buffer> &buffer,
 inline Ref<Accessor> ExportDataSparse(Asset &a, std::string &meshName, Ref<Buffer> &buffer,
         size_t count, void *data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, BufferViewTarget target = BufferViewTarget_NONE, void *dataBase = 0) {
         size_t count, void *data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, BufferViewTarget target = BufferViewTarget_NONE, void *dataBase = 0) {
     if (!count || !data) {
     if (!count || !data) {
@@ -974,13 +973,13 @@ void glTF2Exporter::ExportMeshes()
                     for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
                     for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
                         pPositionDiff[vt] = pAnimMesh->mVertices[vt] - aim->mVertices[vt];
                         pPositionDiff[vt] = pAnimMesh->mVertices[vt] - aim->mVertices[vt];
                     }
                     }
-                    /*Ref<Accessor> vec = ExportData(*mAsset, meshId, b,
+                    Ref<Accessor> vec = ExportData(*mAsset, meshId, b,
                             pAnimMesh->mNumVertices, pPositionDiff,
                             pAnimMesh->mNumVertices, pPositionDiff,
-                            AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);*/
-                    //wangyi 0506
+                            AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
+                    /* sparse
                     Ref<Accessor> vec = ExportDataSparse(*mAsset, meshId, b,
                     Ref<Accessor> vec = ExportDataSparse(*mAsset, meshId, b,
                             pAnimMesh->mNumVertices, pPositionDiff,
                             pAnimMesh->mNumVertices, pPositionDiff,
-                            AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
+                            AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);*/
                     if (vec) {
                     if (vec) {
                         p.targets[am].position.push_back(vec);
                         p.targets[am].position.push_back(vec);
                     }
                     }
@@ -993,13 +992,13 @@ void glTF2Exporter::ExportMeshes()
                     for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
                     for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
                         pNormalDiff[vt] = pAnimMesh->mNormals[vt] - aim->mNormals[vt];
                         pNormalDiff[vt] = pAnimMesh->mNormals[vt] - aim->mNormals[vt];
                     }
                     }
-                    /*Ref<Accessor> vec = ExportData(*mAsset, meshId, b,
-                            pAnimMesh->mNumVertices, pNormalDiff,
-                            AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);*/
-                    //wangyi 0506
                     Ref<Accessor> vec = ExportData(*mAsset, meshId, b,
                     Ref<Accessor> vec = ExportData(*mAsset, meshId, b,
                             pAnimMesh->mNumVertices, pNormalDiff,
                             pAnimMesh->mNumVertices, pNormalDiff,
                             AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
                             AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
+                    /* sparse
+                    Ref<Accessor> vec = ExportDataSparse(*mAsset, meshId, b,
+                            pAnimMesh->mNumVertices, pNormalDiff,
+                            AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);*/
                     if (vec) {
                     if (vec) {
                         p.targets[am].normal.push_back(vec);
                         p.targets[am].normal.push_back(vec);
                     }
                     }