assimp-ffi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7d1aa04481190c3c16c9bd389905b36d8217d8d3c9c3a42e21abb77f58fa1e1
4
- data.tar.gz: b094934f2f1f7fbf5c1e23d098fd0626e9be3d027e0d9ce21c1782f516c82cff
3
+ metadata.gz: 5c192fef8336203feb0bcb02ee19b291d498a234d710ee6b676d5e3f0a21763e
4
+ data.tar.gz: 42cd576210823a906fac2be9a092ec091ade4f1ca56a2f55f6b47924b96be9d5
5
5
  SHA512:
6
- metadata.gz: 95999a134bc79d4ed7ddb7a04196f144d93ea789a5c0036220ddbdab1f0206105ce4f980080ec974a951455053172b3a4033a48981d56630e618568c92b98543
7
- data.tar.gz: 6001365547e0eb714108f2f5dbac2e1dc43ed6240c011c8bd7dfc80d2daec39903d9aab40656e97934d9152af31d373aee57d3fb3e9d9593401e760bd8dc3325
6
+ metadata.gz: 89d297ee3f2f5987edac681ecbc7073c62e205cc0e175190c0de19c9d15100ba0b0b81567a0302f451163a98b84e272c5c8a63651613cc7d7ba13f93e219e66b
7
+ data.tar.gz: 191b40baf47b4c8c5c46a133aa97f07e7d33ef2d08a7e878663b6582e43d7fe89b7f7bd127137a9a22bef14c685c0479f43a79e5515c67d59661a9396e45b44b
data/lib/assimp/mesh.rb CHANGED
@@ -42,6 +42,35 @@ module Assimp
42
42
 
43
43
  struct_array_attr_accessor [:weights, VertexWeight]
44
44
 
45
+ def initialize(ptr = nil)
46
+ if ptr
47
+ super
48
+ else
49
+ ptr = FFI::MemoryPointer::new(self.class.size, 1, true)
50
+ super(ptr)
51
+ offset_matrix.identity!
52
+ end
53
+ end
54
+
55
+ def add_weight(vertex_id, weight)
56
+ vw = VertexWeight::new
57
+ vw.vertex_id = vertex_id
58
+ vw.weight = weight
59
+ push(vw)
60
+ end
61
+
62
+ def push(weight)
63
+ new_ptr = FFI::MemoryPointer::new(VertexWeight, num_weights + 1)
64
+ ptr = self[:weights]
65
+ s = VertexWeight.size
66
+ new_ptr.write_array_of_uint8(ptr.read_array_of_uint8(s*num_weights)) unless ptr.null?
67
+ new_ptr.put_array_of_uint8(num_weights*s, weight.pointer.read_array_of_uint8(s))
68
+ @weights = new_ptr
69
+ self[:weights] = new_ptr
70
+ self.num_weights += 1
71
+ self
72
+ end
73
+
45
74
  end
46
75
 
47
76
  PrimitiveType = bitmask(:primitive_type, [
data/lib/assimp/scene.rb CHANGED
@@ -21,6 +21,16 @@ module Assimp
21
21
 
22
22
  struct_array_attr_accessor [:meshes, :uint]
23
23
 
24
+ def initialize(ptr = nil)
25
+ if ptr
26
+ super
27
+ else
28
+ ptr = FFI::MemoryPointer::new(self.class.size, 1, true)
29
+ super(ptr)
30
+ transformation.identity!
31
+ end
32
+ end
33
+
24
34
  def parent
25
35
  ptr = self[:parent]
26
36
  return nil if ptr.null?
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.1
4
+ version: 0.1.2
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-24 00:00:00.000000000 Z
11
+ date: 2019-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi