Sfoglia il codice sorgente

Issue-1169: fix [] operator of vector3.

Kim Kulling 8 anni fa
parent
commit
695439fad0
3 ha cambiato i file con 235 aggiunte e 209 eliminazioni
  1. 205 205
      CHANGES
  2. 6 2
      include/assimp/vector3.h
  3. 24 2
      include/assimp/vector3.inl

+ 205 - 205
CHANGES

@@ -1,205 +1,205 @@
-----------------------------------------------------------------------
-CHANGELOG
-----------------------------------------------------------------------
-
-3.3.1 (2016-07-08)
-
-FIXES/HOUSEKEEPING:
-    - Setup of default precision for 17 exporters
-    - Fix xcode project files
-    - Fix BlenderTesselator: offsetof operator
-    - Invalid version in cmake file
-    - Update pstdint.h to latest greatest
-
-
-3.3.0 (2016-07-05)
-
-FEATURES:
-    - C++11 support enabled
-    - New regression-test-UI
-    - Experimental glTF-importer support
-    - OpenGEX: add support for cameras and lights
-    - C4D: update to latest Melange-SDK
-    - Add a gitter channel
-    - Coverity check enabled
-    - Switch to <...> include brackets for public headers 
-    - Enable export by pyAssimp
-    - CI: check windows build
-    - Add functionality to perform a singlepost-processing step
-    - many more, just check the history
-
-FIXES/HOUSEKEEPING:
-    - Fix of many resource leaks in unittests and main lib
-    - Fix iOS-buildfor X64
-    - Choosing zlib manually for cmake
-    - many more, just check the history
-
-
-3.2.1 (2016-010-10)
-
-FEATURES:
-  - Updated glTF exporter to meet 1.0 specification.
-
-FIXES/HOUSEKEEPING:
-  - Fixed glTF Validator errors for exported glTF format.
-
-ISSUES:
-  - Hard coded sampler setting for
-    - magFilter
-    - minFilter
-  - void* in ExportData for accessor max and min.
-
-
-3.2.0 (2015-11-03)
-
-FEATURES:
-  - OpenDDL-Parser is part of contrib-source.
-  - Experimental OpenGEX-support
-  - CI-check for linux and windows
-  - Coverity check added
-  - New regression testsuite.
-
-FIXES/HOUSEKEEPING:
-  - Hundreds of bugfixes  in all parts of the library
-  - Unified line endings
-
-
-API COMPATIBILITY:
-  - Removed precompiled header to increase build speed for linux
-
-
-3.1.1 (2014-06-15)
-
-FEATURES:
-   - Support for FBX 2013 and newer, binary and ASCII (this is partly
-     work from Google Summer of Code 2012)
-   - Support for OGRE binary mesh and skeleton format
-   - Updated BLEND support for newer Blender versions
-   - Support for arbitrary meta data, used to hold FBX and DAE metadata
-   - OBJ Export now produces smaller files
-   - Meshes can now have names, this is supported by the major importers
-   - Improved IFC geometry generation
-   - M3 support has been removed
-
-FIXES/HOUSEKEEPING:
-    - Hundreds of bugfixes in all parts of the library
-    - CMake is now the primary build system
-
-API COMPATIBILITY:
-    - 3.1.1 is not binary compatible to 3.0 due to aiNode::mMetaData
-      and aiMesh::mName
-    - Export interface has been cleaned up and unified
-    - Other than that no relevant changes
-
-
-3.0 (2012-07-07)
-
-FEATURES:
-   - new export interface similar to the import API.
-   - Supported export formats: Collada, OBJ, PLY and STL
-   - added new import formats: XGL/ZGL, M3 (experimental)
-   - new postprocessing steps: Debone
-   - vastly improved IFC (Industry Foundation Classes) support
-   - introduced API to query importer meta information (such as supported
-       format versions, full name, maintainer info).
-   - reworked Ogre XML import
-   - C-API now supports per-import properties
-
-FIXES/HOUSEKEEPING:
-
-   - hundreds of bugfixes in all parts of the library
-   - unified naming and cleanup of public headers
-   - improved CMake build system
-   - templatized math library
-   - reduce dependency on boost.thread, only remaining spot
-     is synchronization for the C logging API
-
-API COMPATIBILITY:
-   - renamed headers, export interface, C API properties and meta data
-     prevent compatibility with code written for 2.0, but in
-     most cases these can be easily resolved
-   - Note: 3.0 is not binary compatible with 2.0
-
-
-
-
-2.0 (2010-11-21)
-
-FEATURES:
-   - Add support for static Blender (*.blend) scenes
-   - Add support for Q3BSP scenes
-   - Add a windows-based OpenGL sample featuring texturing & basic materials
-   - Add an experimental progress feedback interface.
-   - Vastly improved performance (up to 500%, depending on mesh size and
-     spatial structure) in some expensive postprocessing steps
-   - AssimpView now uses a reworked layout which leaves more space
-     to the scene hierarchy window
-
-   - Add C# bindings ('Assimp.NET')
-   - Keep BSD-licensed and otherwise free test files in separate
-     folders (./test/models and ./test/models-nonbsd).
-
-FIXES:
-   - Many Collada bugfixes, improve fault tolerance
-   - Fix possible crashes in the Obj loader
-   - Improve the Ogre XML loader
-   - OpenGL-sample now works with MinGW
-   - Fix Importer::FindLoader failing on uppercase file extensions
-   - Fix flawed path handling when locating external files
-   - Limit the maximum number of vertices, faces, face indices and
-     weights that Assimp is able to handle. This is to avoid
-     crashes due to overflowing counters.
-
-   - Updated XCode project files
-   - Further CMAKE build improvements
-
-
-API CHANGES:
-   - Add data structures for vertex-based animations (These are not
-     currently used, however ...)
-   - Some Assimp::Importer methods are const now.
-
-
-
-
-
-1.1 (2010-04-17)
-This is the list of relevant changes from the 1.0 (r412) release to 1.1 (r700).
-
-FEATURES:
-  - Vastly improved Collada support
-  - Add MS3D (Milkshape 3D) support
-  - Add support for Ogre XML static meshes
-  - Add experimental COB (TrueSpace) support
-  - Automatic test suite to quickly locate regressions
-  - D bindings (`dAssimp`)
-  - Python 2.n bindings (`PyAssimp`)
-  - Add basic support for Unicode input files (utf8, utf16 and utf32)
-  - Add further utilities to the `assimp` tool (xml/binary dumps, quick file stats)
-  - Switch to a CMAKE-based build system including an install target for unix'es
-  - Automatic evaluation of subdivision surfaces for some formats.
-  - Add `Importer::ReadFileFromMemory` and the corresponding C-API `aiReadFileFromMemory`
-  - Expose further math utilities via the C-API (i.e. `aiMultiplyMatrix4`)
-
-  - Move noboost files away from the public include directory
-  - Many, many bugfixes and improvements in existing loaders and postprocessing steps
-  - Documentation improved and clarified in many places.
-  - Add a sample on using Assimp in conjunction with OpenGL
-
-  - Distribution/packaging: comfortable SDK installer for Windows
-  - Distribution/packaging: improved release packages for other architectures
-
-CRITICAL FIXES:
-  - Resolve problems with clashing heap managers, STL ABIs and runtime libraries (win32)
-  - Fix automatic detection of file type if no file extension is given
-  - Improved exception safety and robustness, prevent leaking of exceptions through the C interface
-  - Fix possible heap corruption due to material properties pulled in incorrectly
-  - Avoid leaking in certain error scenarios
-  - Fix 64 bit compatibility problems in some loaders (i.e. MDL)
-
-BREAKING API CHANGES:
-  - None -
-
-MINOR API BEHAVIOUR CHANGES:
- - Change quaternion orientation to suit to the more common convention (-w).
- - aiString is utf8 now. Not yet consistent, however.
+----------------------------------------------------------------------
+CHANGELOG
+----------------------------------------------------------------------
+
+3.3.1 (2016-07-08)
+
+FIXES/HOUSEKEEPING:
+    - Setup of default precision for 17 exporters
+    - Fix xcode project files
+    - Fix BlenderTesselator: offsetof operator
+    - Invalid version in cmake file
+    - Update pstdint.h to latest greatest
+
+
+3.3.0 (2016-07-05)
+
+FEATURES:
+    - C++11 support enabled
+    - New regression-test-UI
+    - Experimental glTF-importer support
+    - OpenGEX: add support for cameras and lights
+    - C4D: update to latest Melange-SDK
+    - Add a gitter channel
+    - Coverity check enabled
+    - Switch to <...> include brackets for public headers 
+    - Enable export by pyAssimp
+    - CI: check windows build
+    - Add functionality to perform a singlepost-processing step
+    - many more, just check the history
+
+FIXES/HOUSEKEEPING:
+    - Fix of many resource leaks in unittests and main lib
+    - Fix iOS-buildfor X64
+    - Choosing zlib manually for cmake
+    - many more, just check the history
+
+
+3.2.1 (2016-010-10)
+
+FEATURES:
+  - Updated glTF exporter to meet 1.0 specification.
+
+FIXES/HOUSEKEEPING:
+  - Fixed glTF Validator errors for exported glTF format.
+
+ISSUES:
+  - Hard coded sampler setting for
+    - magFilter
+    - minFilter
+  - void* in ExportData for accessor max and min.
+
+
+3.2.0 (2015-11-03)
+
+FEATURES:
+  - OpenDDL-Parser is part of contrib-source.
+  - Experimental OpenGEX-support
+  - CI-check for linux and windows
+  - Coverity check added
+  - New regression testsuite.
+
+FIXES/HOUSEKEEPING:
+  - Hundreds of bugfixes  in all parts of the library
+  - Unified line endings
+
+
+API COMPATIBILITY:
+  - Removed precompiled header to increase build speed for linux
+
+
+3.1.1 (2014-06-15)
+
+FEATURES:
+   - Support for FBX 2013 and newer, binary and ASCII (this is partly
+     work from Google Summer of Code 2012)
+   - Support for OGRE binary mesh and skeleton format
+   - Updated BLEND support for newer Blender versions
+   - Support for arbitrary meta data, used to hold FBX and DAE metadata
+   - OBJ Export now produces smaller files
+   - Meshes can now have names, this is supported by the major importers
+   - Improved IFC geometry generation
+   - M3 support has been removed
+
+FIXES/HOUSEKEEPING:
+    - Hundreds of bugfixes in all parts of the library
+    - CMake is now the primary build system
+
+API COMPATIBILITY:
+    - 3.1.1 is not binary compatible to 3.0 due to aiNode::mMetaData
+      and aiMesh::mName
+    - Export interface has been cleaned up and unified
+    - Other than that no relevant changes
+
+
+3.0 (2012-07-07)
+
+FEATURES:
+   - new export interface similar to the import API.
+   - Supported export formats: Collada, OBJ, PLY and STL
+   - added new import formats: XGL/ZGL, M3 (experimental)
+   - new postprocessing steps: Debone
+   - vastly improved IFC (Industry Foundation Classes) support
+   - introduced API to query importer meta information (such as supported
+       format versions, full name, maintainer info).
+   - reworked Ogre XML import
+   - C-API now supports per-import properties
+
+FIXES/HOUSEKEEPING:
+
+   - hundreds of bugfixes in all parts of the library
+   - unified naming and cleanup of public headers
+   - improved CMake build system
+   - templatized math library
+   - reduce dependency on boost.thread, only remaining spot
+     is synchronization for the C logging API
+
+API COMPATIBILITY:
+   - renamed headers, export interface, C API properties and meta data
+     prevent compatibility with code written for 2.0, but in
+     most cases these can be easily resolved
+   - Note: 3.0 is not binary compatible with 2.0
+
+
+
+
+2.0 (2010-11-21)
+
+FEATURES:
+   - Add support for static Blender (*.blend) scenes
+   - Add support for Q3BSP scenes
+   - Add a windows-based OpenGL sample featuring texturing & basic materials
+   - Add an experimental progress feedback interface.
+   - Vastly improved performance (up to 500%, depending on mesh size and
+     spatial structure) in some expensive postprocessing steps
+   - AssimpView now uses a reworked layout which leaves more space
+     to the scene hierarchy window
+
+   - Add C# bindings ('Assimp.NET')
+   - Keep BSD-licensed and otherwise free test files in separate
+     folders (./test/models and ./test/models-nonbsd).
+
+FIXES:
+   - Many Collada bugfixes, improve fault tolerance
+   - Fix possible crashes in the Obj loader
+   - Improve the Ogre XML loader
+   - OpenGL-sample now works with MinGW
+   - Fix Importer::FindLoader failing on uppercase file extensions
+   - Fix flawed path handling when locating external files
+   - Limit the maximum number of vertices, faces, face indices and
+     weights that Assimp is able to handle. This is to avoid
+     crashes due to overflowing counters.
+
+   - Updated XCode project files
+   - Further CMAKE build improvements
+
+
+API CHANGES:
+   - Add data structures for vertex-based animations (These are not
+     currently used, however ...)
+   - Some Assimp::Importer methods are const now.
+
+
+
+
+
+1.1 (2010-04-17)
+This is the list of relevant changes from the 1.0 (r412) release to 1.1 (r700).
+
+FEATURES:
+  - Vastly improved Collada support
+  - Add MS3D (Milkshape 3D) support
+  - Add support for Ogre XML static meshes
+  - Add experimental COB (TrueSpace) support
+  - Automatic test suite to quickly locate regressions
+  - D bindings (`dAssimp`)
+  - Python 2.n bindings (`PyAssimp`)
+  - Add basic support for Unicode input files (utf8, utf16 and utf32)
+  - Add further utilities to the `assimp` tool (xml/binary dumps, quick file stats)
+  - Switch to a CMAKE-based build system including an install target for unix'es
+  - Automatic evaluation of subdivision surfaces for some formats.
+  - Add `Importer::ReadFileFromMemory` and the corresponding C-API `aiReadFileFromMemory`
+  - Expose further math utilities via the C-API (i.e. `aiMultiplyMatrix4`)
+
+  - Move noboost files away from the public include directory
+  - Many, many bugfixes and improvements in existing loaders and postprocessing steps
+  - Documentation improved and clarified in many places.
+  - Add a sample on using Assimp in conjunction with OpenGL
+
+  - Distribution/packaging: comfortable SDK installer for Windows
+  - Distribution/packaging: improved release packages for other architectures
+
+CRITICAL FIXES:
+  - Resolve problems with clashing heap managers, STL ABIs and runtime libraries (win32)
+  - Fix automatic detection of file type if no file extension is given
+  - Improved exception safety and robustness, prevent leaking of exceptions through the C interface
+  - Fix possible heap corruption due to material properties pulled in incorrectly
+  - Avoid leaking in certain error scenarios
+  - Fix 64 bit compatibility problems in some loaders (i.e. MDL)
+
+BREAKING API CHANGES:
+  - None -
+
+MINOR API BEHAVIOUR CHANGES:
+ - Change quaternion orientation to suit to the more common convention (-w).
+ - aiString is utf8 now. Not yet consistent, however.

+ 6 - 2
include/assimp/vector3.h

@@ -125,6 +125,12 @@ public:
      *  @param o Second factor */
     const aiVector3t SymMul(const aiVector3t& o);
 
+	/*union vector3 { 
+		TReal values[3]; 
+		struct { 
+			TReal x, y, z; 
+		}; 
+	};*/
     TReal x, y, z;
 } PACK_STRUCT;
 
@@ -143,8 +149,6 @@ struct aiVector3D {
 
 #ifdef __cplusplus
 
-
-
 #endif // __cplusplus
 
 #endif // AI_VECTOR3D_H_INC

+ 24 - 2
include/assimp/vector3.inl

@@ -141,12 +141,34 @@ AI_FORCE_INLINE aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatri
 // ------------------------------------------------------------------------------------------------
 template <typename TReal>
 AI_FORCE_INLINE TReal aiVector3t<TReal>::operator[](unsigned int i) const {
-    return *(&x + i);
+//    return *(&x + i);
+    switch (i) {
+        case 0:
+            return x;
+        case 1:
+            return y;
+        case 2:
+            return z;
+        default:
+            break;
+    }
+    return x;
 }
 // ------------------------------------------------------------------------------------------------
 template <typename TReal>
 AI_FORCE_INLINE TReal& aiVector3t<TReal>::operator[](unsigned int i) {
-    return *(&x + i);
+//    return *(&x + i);
+    switch (i) {
+        case 0:
+            return x;
+        case 1:
+            return y;
+        case 2:
+            return z;
+        default:
+            break;
+    }
+    return x;
 }
 // ------------------------------------------------------------------------------------------------
 template <typename TReal>