89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/assimp/import.rb', line 89
def self.config_setter(*args)
args.each { |name, type|
prop = name.upcase.to_s
meth_name = name.to_s.downcase + "="
if type == :bool
define_method(meth_name) do |bool|
raise "Invalid bool value #{bool.inspect}" unless bool == Assimp::TRUE || bool == Assimp::FALSE
Assimp::aiSetImportPropertyInteger(self, prop, bool)
bool
end
elsif type == :int
define_method(meth_name) do |val|
Assimp::aiSetImportPropertyInteger(self, prop, val)
val
end
elsif type == :float
define_method(meth_name) do |val|
Assimp::aiSetImportPropertyFloat(self, prop, val)
val
end
elsif type == :matrix4x4
define_method(meth_name) do |mat|
Assimp::aiSetImportPropertyMatrix(self, prop, mat)
mat
end
elsif type == :string
define_method(meth_name) do |str|
s = String::new
s.data = str
Assimp::aiSetImportPropertyString(self, prop, s)
str
end
elsif type == :string_array
define_method(meth_name) do |args|
str = args.collect { |a| a =~ /\s/ ? "\'"+a+"\'" : a }.join(" ")
s = String::new
s.data = str
Assimp::aiSetImportPropertyString(self, prop, s)
args
end
end
}
end
|