assimp-ffi 0.1.1 → 0.1.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/lib/assimp/mesh.rb +29 -0
- data/lib/assimp/scene.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c192fef8336203feb0bcb02ee19b291d498a234d710ee6b676d5e3f0a21763e
|
4
|
+
data.tar.gz: 42cd576210823a906fac2be9a092ec091ade4f1ca56a2f55f6b47924b96be9d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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-
|
11
|
+
date: 2019-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|