assimp 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.rdoc +6 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/ext/assimp/assimp_aibone.c +1 -1
- data/ext/assimp/assimp_importer.c +63 -52
- data/lib/assimp.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: eee234d3825f9b4c8af0cc10d6333afd34b19884
         | 
| 4 | 
            +
              data.tar.gz: c1ace6c4ff29adb75270e2f95bfedacc152c08b9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: aa734b7160f8830b7658c265776696950c4007cbb4803b2b39beae71aa25c07b84d05145fe9bc2aa1d2d3fb594007750019d036337439d807cd59eed8fe7be24
         | 
| 7 | 
            +
              data.tar.gz: e33d24b11d4884810ce6117680e843855271d27662cffefd019ed5421140908697dd93e2ceb8aae5f5161c0684900b5fd21b9474b01dbc8c3ea45cd0f882c6ea
         | 
    
        data/History.rdoc
    CHANGED
    
    
    
        data/README.rdoc
    CHANGED
    
    | @@ -30,7 +30,7 @@ https://github.com/coballast/assimp | |
| 30 30 | 
             
              scene = importer.read_file("example_file.3ds", 
         | 
| 31 31 | 
             
                [:triangulate, :make_left_handed, :calc_tangent_space]);
         | 
| 32 32 |  | 
| 33 | 
            -
              pp scene | 
| 33 | 
            +
              pp scene 
         | 
| 34 34 |  | 
| 35 35 | 
             
              # out prints nicely formated data like meshes, 
         | 
| 36 36 | 
             
              # animations, and materials for consumption by say, a webgl front end renderer.
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/ext/assimp/assimp_aibone.c
    CHANGED
    
    | @@ -5,7 +5,7 @@ VALUE get_Hash_from_aiBone(struct aiBone * bone) | |
| 5 5 | 
             
              VALUE result, name, offset_matrix, weights;
         | 
| 6 6 | 
             
              unsigned int i;
         | 
| 7 7 | 
             
              result = rb_hash_new();
         | 
| 8 | 
            -
              name =  | 
| 8 | 
            +
              name = get_rb_str_from_aiString(&bone->mName);
         | 
| 9 9 | 
             
              offset_matrix = get_Array_from_aiMatrix4x4(&bone->mOffsetMatrix);
         | 
| 10 10 | 
             
              weights = rb_ary_new();
         | 
| 11 11 | 
             
              for(i = 0; i < bone->mNumWeights; i++){
         | 
| @@ -5,73 +5,84 @@ static VALUE initialize(VALUE self) | |
| 5 5 | 
             
              return self;
         | 
| 6 6 | 
             
            }
         | 
| 7 7 |  | 
| 8 | 
            +
            unsigned int get_flags(VALUE flags_array)
         | 
| 9 | 
            +
            {
         | 
| 10 | 
            +
              unsigned int array_len, i, flags;
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              Check_Type(flags_array, T_ARRAY);
         | 
| 13 | 
            +
              flags = 0;
         | 
| 14 | 
            +
              array_len = RARRAY_LEN(flags_array);
         | 
| 15 | 
            +
              for(i = 0; i < array_len; i++){
         | 
| 16 | 
            +
                VALUE element;
         | 
| 17 | 
            +
                element = rb_ary_entry(flags_array, i);
         | 
| 18 | 
            +
                if(TYPE(element)==T_SYMBOL){
         | 
| 19 | 
            +
                  ID sym_id;
         | 
| 20 | 
            +
                  sym_id = SYM2ID(element);
         | 
| 21 | 
            +
                  if(sym_id==rb_intern("triangulate"))
         | 
| 22 | 
            +
                    flags |= aiProcess_Triangulate;
         | 
| 23 | 
            +
                  
         | 
| 24 | 
            +
                  if(sym_id==rb_intern("calc_tangent_space"))
         | 
| 25 | 
            +
                    flags |= aiProcess_CalcTangentSpace;
         | 
| 26 | 
            +
                  
         | 
| 27 | 
            +
                  if(sym_id==rb_intern("make_left_handed"))
         | 
| 28 | 
            +
                    flags |= aiProcess_MakeLeftHanded;
         | 
| 29 | 
            +
                  
         | 
| 30 | 
            +
                  if(sym_id==rb_intern("gen_normals"))
         | 
| 31 | 
            +
                    flags |= aiProcess_GenNormals;
         | 
| 32 | 
            +
                  
         | 
| 33 | 
            +
                  if(sym_id==rb_intern("gen_smooth_normals"))
         | 
| 34 | 
            +
                    flags |= aiProcess_GenSmoothNormals;
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  if(sym_id==rb_intern("gen_uv_coords"))
         | 
| 37 | 
            +
                    flags |= aiProcess_GenUVCoords;
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                  if(sym_id==rb_intern("transform_uv_coords"))
         | 
| 40 | 
            +
                    flags |= aiProcess_TransformUVCoords;
         | 
| 41 | 
            +
                  
         | 
| 42 | 
            +
                  if(sym_id==rb_intern("join_identical_vertices"))
         | 
| 43 | 
            +
                    flags |= aiProcess_JoinIdenticalVertices;
         | 
| 44 | 
            +
                  
         | 
| 45 | 
            +
                  if(sym_id==rb_intern("pretransform_vertices"))
         | 
| 46 | 
            +
                    flags |= aiProcess_PreTransformVertices;
         | 
| 47 | 
            +
                  
         | 
| 48 | 
            +
                  if(sym_id==rb_intern("validate_data_structure"))
         | 
| 49 | 
            +
                    flags |= aiProcess_ValidateDataStructure;
         | 
| 50 | 
            +
                  
         | 
| 51 | 
            +
                  if(sym_id==rb_intern("improve_cache_locality"))
         | 
| 52 | 
            +
                    flags |= aiProcess_ImproveCacheLocality;
         | 
| 53 | 
            +
                  
         | 
| 54 | 
            +
                  if(sym_id==rb_intern("fix_infacing_normals"))
         | 
| 55 | 
            +
                    flags |= aiProcess_FixInfacingNormals;
         | 
| 56 | 
            +
                  
         | 
| 57 | 
            +
                  if(sym_id==rb_intern("sort_by_p_type"))
         | 
| 58 | 
            +
                    flags |= aiProcess_SortByPType; 
         | 
| 59 | 
            +
                }
         | 
| 60 | 
            +
              }
         | 
| 61 | 
            +
              return flags; 
         | 
| 62 | 
            +
            }
         | 
| 63 | 
            +
             | 
| 8 64 | 
             
            static VALUE read_file(VALUE self, VALUE args)
         | 
| 9 65 | 
             
            {
         | 
| 10 66 | 
             
              char * file_str;
         | 
| 11 67 | 
             
              struct aiScene * scene;
         | 
| 12 | 
            -
              unsigned int flags | 
| 68 | 
            +
              unsigned int flags;
         | 
| 13 69 | 
             
              long num_args;
         | 
| 14 | 
            -
              VALUE file_name,  | 
| 70 | 
            +
              VALUE file_name, result;
         | 
| 15 71 | 
             
              flags = 0;
         | 
| 16 72 | 
             
              num_args = RARRAY_LEN(args);
         | 
| 73 | 
            +
              result = Qnil;
         | 
| 74 | 
            +
             | 
| 17 75 | 
             
              if(num_args > 2 || num_args < 1)
         | 
| 18 76 | 
             
                rb_raise(rb_eArgError, "wrong number of arguments");
         | 
| 19 77 |  | 
| 20 78 | 
             
              file_name = rb_ary_entry(args, 0);
         | 
| 21 | 
            -
              Check_Type(file_name, T_STRING);
         | 
| 22 | 
            -
              if(num_args > 1){
         | 
| 23 | 
            -
                read_flags = rb_ary_entry(args, 1);
         | 
| 24 | 
            -
                Check_Type(read_flags, T_ARRAY);
         | 
| 25 | 
            -
                array_len = RARRAY_LEN(read_flags); 
         | 
| 26 | 
            -
              }
         | 
| 27 | 
            -
             | 
| 79 | 
            +
              Check_Type(file_name, T_STRING); 
         | 
| 28 80 | 
             
              file_str = StringValueCStr(file_name);
         | 
| 29 81 |  | 
| 30 | 
            -
              if(num_args > 1) | 
| 31 | 
            -
             | 
| 32 | 
            -
                  VALUE element = rb_ary_entry(read_flags, i);
         | 
| 33 | 
            -
                  if(TYPE(element)==T_SYMBOL){
         | 
| 34 | 
            -
                    ID sym_id = SYM2ID(element);
         | 
| 35 | 
            -
                    if(sym_id==rb_intern("triangulate")){
         | 
| 36 | 
            -
                      flags |= aiProcess_Triangulate;
         | 
| 37 | 
            -
                    }
         | 
| 38 | 
            -
                    if(sym_id==rb_intern("calc_tangent_space")){
         | 
| 39 | 
            -
                      flags |= aiProcess_CalcTangentSpace;
         | 
| 40 | 
            -
                    }
         | 
| 41 | 
            -
                    if(sym_id==rb_intern("make_left_handed")){
         | 
| 42 | 
            -
                      flags |= aiProcess_MakeLeftHanded;
         | 
| 43 | 
            -
                    }
         | 
| 44 | 
            -
                    if(sym_id==rb_intern("gen_normals")){
         | 
| 45 | 
            -
                      flags |= aiProcess_GenNormals;
         | 
| 46 | 
            -
                    }
         | 
| 47 | 
            -
                    if(sym_id==rb_intern("gen_smooth_normals")){
         | 
| 48 | 
            -
                      flags |= aiProcess_GenSmoothNormals;
         | 
| 49 | 
            -
                    }
         | 
| 50 | 
            -
                    if(sym_id==rb_intern("join_identical_vertices")){
         | 
| 51 | 
            -
                      flags |= aiProcess_JoinIdenticalVertices;
         | 
| 52 | 
            -
                    }
         | 
| 53 | 
            -
                    if(sym_id==rb_intern("pretransform_vertices")){
         | 
| 54 | 
            -
                      flags |= aiProcess_PreTransformVertices;
         | 
| 55 | 
            -
                    }
         | 
| 56 | 
            -
                    if(sym_id==rb_intern("validate_data_structure")){
         | 
| 57 | 
            -
                      flags |= aiProcess_ValidateDataStructure;
         | 
| 58 | 
            -
                    }
         | 
| 59 | 
            -
                    if(sym_id==rb_intern("improve_cache_locality")){
         | 
| 60 | 
            -
                      flags |= aiProcess_ImproveCacheLocality;
         | 
| 61 | 
            -
                    }
         | 
| 62 | 
            -
                    if(sym_id==rb_intern("fix_infacing_normals")){
         | 
| 63 | 
            -
                      flags |= aiProcess_FixInfacingNormals;
         | 
| 64 | 
            -
                    }
         | 
| 65 | 
            -
                    if(sym_id==rb_intern("sort_by_p_type")){
         | 
| 66 | 
            -
                      flags |= aiProcess_SortByPType;
         | 
| 67 | 
            -
                    }
         | 
| 68 | 
            -
                  }
         | 
| 69 | 
            -
                }
         | 
| 70 | 
            -
              }
         | 
| 82 | 
            +
              if(num_args > 1)
         | 
| 83 | 
            +
                flags = get_flags(rb_ary_entry(args, 1));
         | 
| 71 84 |  | 
| 72 85 | 
             
              scene = aiImportFile(file_str, flags);
         | 
| 73 | 
            -
              VALUE result;
         | 
| 74 | 
            -
              result = Qnil;
         | 
| 75 86 |  | 
| 76 87 | 
             
              if(!scene)
         | 
| 77 88 | 
             
                rb_raise(rb_eIOError, aiGetErrorString());
         | 
    
        data/lib/assimp.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: assimp
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Colin Ballast
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-01 | 
| 11 | 
            +
            date: 2014-02-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rdoc
         |