magica_voxel 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/magica_voxel/main.rb +7 -0
- data/lib/magica_voxel/material.rb +78 -3
- data/lib/magica_voxel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 599121b316f48657a80a305f1736dac67841dea607bd457316912a3f26e278df
|
4
|
+
data.tar.gz: f5db1174780884c4a2b1218603510d3ead7447221dc6c9caf155d9f629e10933
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d2d6172ec2ff0fbcec0694bb1c4fde6ee41d57c80441b61cf3d9bca522b0d553e9142bf079e8054550e1c2575515105efd1fae6f4b96a10a1909702408cbea0
|
7
|
+
data.tar.gz: bc4d8c3a1f977056e74c016e1b69cfbb305b7d53154627438677ff7d42671a0c0cdcea8efe8cc99791aec093b9b5893cc3d2b1129db9274b56051b90b4ff8a8a
|
data/Gemfile.lock
CHANGED
data/lib/magica_voxel/main.rb
CHANGED
@@ -5,5 +5,12 @@ module MagicaVoxel
|
|
5
5
|
#
|
6
6
|
# @since 0.1.0
|
7
7
|
class Main < Chunk
|
8
|
+
# @return [Array<Array<MagicaVoxel::Size|MagicalVoxel::Model>>]
|
9
|
+
#
|
10
|
+
# @since 0.1.0
|
11
|
+
def models
|
12
|
+
select { |chunk| chunk.is_a?(MagicaVoxel::Size) || chunk.is_a?(MagicaVoxel::Model) }
|
13
|
+
.each_slice(2)
|
14
|
+
end
|
8
15
|
end
|
9
16
|
end
|
@@ -8,15 +8,90 @@ module MagicaVoxel
|
|
8
8
|
# @since 0.1.0
|
9
9
|
attr_reader :id, :properties
|
10
10
|
|
11
|
+
# Material Type
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
#
|
15
|
+
# @since 0.1.0
|
16
|
+
def type
|
17
|
+
@type ||= @properties['_type'][1..-1]
|
18
|
+
end
|
19
|
+
|
20
|
+
# Weight
|
21
|
+
#
|
22
|
+
# @return [Number]
|
23
|
+
#
|
24
|
+
# @since 0.2.0
|
25
|
+
def weight
|
26
|
+
@weight ||= @properties['_weight'].to_f
|
27
|
+
end
|
28
|
+
|
29
|
+
# Roughness
|
30
|
+
#
|
31
|
+
# @return [Number]
|
32
|
+
#
|
33
|
+
# @since 0.2.0
|
34
|
+
def roughness
|
35
|
+
@roughness ||= @properties['_rough'].to_f
|
36
|
+
end
|
37
|
+
|
38
|
+
# Specular
|
39
|
+
#
|
40
|
+
# @return [Number]
|
41
|
+
#
|
42
|
+
# @since 0.2.0
|
43
|
+
def specular
|
44
|
+
@specular ||= @properties['_spec'].to_f
|
45
|
+
end
|
46
|
+
|
47
|
+
# Index of Refraction
|
48
|
+
#
|
49
|
+
# @return [Number]
|
50
|
+
#
|
51
|
+
# @since 0.2.0
|
52
|
+
def ior
|
53
|
+
@ior ||= @properties['_ior'].to_f
|
54
|
+
end
|
55
|
+
|
56
|
+
# TODO: Att
|
57
|
+
#
|
58
|
+
# @return [Number]
|
59
|
+
#
|
60
|
+
# @since 0.2.0
|
61
|
+
def att
|
62
|
+
@att ||= @properties['_att'].to_f
|
63
|
+
end
|
64
|
+
|
65
|
+
# TODO: Flux
|
66
|
+
#
|
67
|
+
# @return [Number]
|
68
|
+
#
|
69
|
+
# @since 0.2.0
|
70
|
+
def flux
|
71
|
+
@flux ||= @properties['_flux'].to_f
|
72
|
+
end
|
73
|
+
|
74
|
+
# TODO: Plastic
|
75
|
+
#
|
76
|
+
# @return [TureClass|FalseClass]
|
77
|
+
#
|
78
|
+
# @since 0.1.0
|
79
|
+
def plastic?
|
80
|
+
@properties['_plastic'] == '1'
|
81
|
+
end
|
82
|
+
|
11
83
|
# :nodoc:
|
12
84
|
#
|
13
85
|
# @since 0.1.0
|
14
86
|
def inspect
|
15
|
-
|
87
|
+
'#<MagicaVoxel::Material ' \
|
88
|
+
"id=#{id}, type=#{type}, " \
|
89
|
+
"weight=#{weight}, roughness=#{roughness}, " \
|
90
|
+
"specular=#{specular}, ior=#{ior}, " \
|
91
|
+
"att=#{att}, flux=#{flux}, " \
|
92
|
+
"plastic=#{plastic?}>"
|
16
93
|
end
|
17
94
|
|
18
|
-
# TODO: Expose Properties
|
19
|
-
|
20
95
|
private
|
21
96
|
|
22
97
|
# :nodoc:
|
data/lib/magica_voxel/version.rb
CHANGED