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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc1d97e530ef11e5fad7ec14111fbb5de76f7812774fd5d68e83bc9e597ee3ce
4
- data.tar.gz: 95e1be35b14f19fe594d0c048e9b4d4762e9fb43cb24e5864ae7e3eaea1c41b1
3
+ metadata.gz: 599121b316f48657a80a305f1736dac67841dea607bd457316912a3f26e278df
4
+ data.tar.gz: f5db1174780884c4a2b1218603510d3ead7447221dc6c9caf155d9f629e10933
5
5
  SHA512:
6
- metadata.gz: a862e3cba3c2ed652f9a51abed0ac948162582eba2ec5a2e62a518e6313ba6b3200291bf3019ef6afc80c12aa37d7c954a257bf73435279594e190601063df29
7
- data.tar.gz: f93d877ef345ce7d9f188ddcf828a878c9e4563fb571a801f85d3615aa470e585ea9afba8428e311255083e727ba6e84341bed1f18022228e54ed24191427d97
6
+ metadata.gz: 8d2d6172ec2ff0fbcec0694bb1c4fde6ee41d57c80441b61cf3d9bca522b0d553e9142bf079e8054550e1c2575515105efd1fae6f4b96a10a1909702408cbea0
7
+ data.tar.gz: bc4d8c3a1f977056e74c016e1b69cfbb305b7d53154627438677ff7d42671a0c0cdcea8efe8cc99791aec093b9b5893cc3d2b1129db9274b56051b90b4ff8a8a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- magica_voxel (0.1.0)
4
+ magica_voxel (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
- "#<MagicaVoxel::Material id=#{id}>"
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:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MagicaVoxel
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magica_voxel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 蒼時弦也