assimp-ffi 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2f350f15b0e5131cd2404dadc2a26aad6d818abf3eab0fb7766e47e99eef6cd
4
- data.tar.gz: d28e89aefa90d07b6a0e04812d0590b7fd117ac5b3cc933920d549e0813b521c
3
+ metadata.gz: b7d1aa04481190c3c16c9bd389905b36d8217d8d3c9c3a42e21abb77f58fa1e1
4
+ data.tar.gz: b094934f2f1f7fbf5c1e23d098fd0626e9be3d027e0d9ce21c1782f516c82cff
5
5
  SHA512:
6
- metadata.gz: f13d6c65bc8a7074c0e9b1b471d2667707ab14f20890bfb951e703bb77f2d17e4c765252884ff0ac2c226e72680bd47273d7715f1f13de2fe33f5a7b8b5c379c
7
- data.tar.gz: 61796c36f6d41e14e116a1e3c5d831e2534175298ab7af5eeead0bf31dfb619253f154a62d0b14bb1403dd8aa3ba1f293a04079448a50e7f5d6371eaf4e23fd9
6
+ metadata.gz: 95999a134bc79d4ed7ddb7a04196f144d93ea789a5c0036220ddbdab1f0206105ce4f980080ec974a951455053172b3a4033a48981d56630e618568c92b98543
7
+ data.tar.gz: 6001365547e0eb714108f2f5dbac2e1dc43ed6240c011c8bd7dfc80d2daec39903d9aab40656e97934d9152af31d373aee57d3fb3e9d9593401e760bd8dc3325
data/lib/assimp/base.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  module Assimp
2
2
  extend FFI::Library
3
- ffi_lib 'assimp'
3
+
4
+ if ENV['ASSIMP_PATH']
5
+ ffi_lib(ENV['ASSIMP_PATH'])
6
+ else
7
+ ffi_lib 'assimp'
8
+ end
4
9
 
5
10
  class String < FFI::Struct
6
11
  end
@@ -172,6 +172,11 @@ module Assimp
172
172
 
173
173
  @__has_ref = true
174
174
 
175
+ def self.property(key, val, semantic: 0, index: 0, type: nil)
176
+ p = MaterialProperty::new
177
+ p.set_property(key, val, semantic: semantic, index: index, type: type)
178
+ end
179
+
175
180
  def set_property(key, val, semantic: 0, index: 0, type: nil)
176
181
  if type
177
182
  self.type = type
@@ -377,6 +382,27 @@ module Assimp
377
382
  MaterialProperty::new(new_ptr)
378
383
  end
379
384
 
385
+ def add_property(key, val, semantic: 0, index: 0, type: nil)
386
+ push(MaterialProperty::property(key, val, semantic: semantic, index: index, type: type))
387
+ end
388
+
389
+ def push(property)
390
+ @properties = [nil, []] unless @properties
391
+ @properties[1].push(property)
392
+ if num_allocated > num_properties
393
+ self[:properties].put_pointer(FFI::Pointer.size*num_properties, property.pointer)
394
+ else
395
+ self.num_allocated = [32, num_allocated*2].max
396
+ new_ptr = FFI::MemoryPointer::new(:pointer, num_allocated)
397
+ new_ptr.write_array_of_pointer(self[:properties].read_array_of_pointer(num_properties)) unless self[:properties].null?
398
+ new_ptr[num_properties].write_pointer(property.pointer)
399
+ @properties[0] = new_ptr
400
+ self[:properties] = new_ptr
401
+ end
402
+ self.num_properties += 1
403
+ self
404
+ end
405
+
380
406
  end
381
407
 
382
408
  attach_function :aiGetMaterialProperty,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assimp-ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Videau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-23 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -39,7 +39,6 @@ extra_rdoc_files: []
39
39
  files:
40
40
  - LICENSE
41
41
  - README.md
42
- - assimp.gemspec
43
42
  - lib/assimp-ffi.rb
44
43
  - lib/assimp/anim.rb
45
44
  - lib/assimp/base.rb
data/assimp.gemspec DELETED
@@ -1,14 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = 'assimp-ffi'
3
- s.version = "0.1.0"
4
- s.author = "Brice Videau"
5
- s.email = "brice.videau@imag.fr"
6
- s.homepage = "https://github.com/Kerilk/assimp-ruby"
7
- s.summary = "Open Asset Import Library bindings"
8
- s.description = "FFI bindings of Assimp (Open Asset Import Library bindings) for version 4.1.0 onward"
9
- s.files = Dir['assimp.gemspec', 'LICENSE', 'README.md', 'lib/**/*']
10
- s.has_rdoc = false
11
- s.license = 'BSD-2-Clause'
12
- s.required_ruby_version = '>= 2.1.0'
13
- s.add_dependency 'ffi', '~> 1.9', '>=1.9.19'
14
- end