Class: Assimp::Scene

Inherits:
FFI::ManagedStruct
  • Object
show all
Extended by:
StructAccessors
Defined in:
lib/assimp/scene.rb

Direct Known Subclasses

SceneCopy

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StructAccessors

extended, has_ref?, struct_array_attr_accessor, struct_array_attr_checker, struct_array_attr_reader, struct_array_attr_writer, struct_attr_accessor, struct_attr_reader, struct_attr_writer, struct_ref_array_attr_accessor, struct_ref_array_attr_reader, struct_ref_array_attr_writer

Class Method Details

.inherited(klass) ⇒ Object



140
141
142
# File 'lib/assimp/scene.rb', line 140

def self.inherited(klass)
  klass.instance_variable_set(:@layout, @layout)
end

.release(ptr) ⇒ Object



144
145
146
# File 'lib/assimp/scene.rb', line 144

def self.release(ptr)
  Assimp::aiReleaseImport(ptr)
end

Instance Method Details

#apply_post_processing(steps) ⇒ Object



158
159
160
161
162
# File 'lib/assimp/scene.rb', line 158

def apply_post_processing(steps)
  ptr = Assimp::aiApplyPostProcessing(self, steps)
  raise "Post processing failed!" if ptr.null?
  self
end

#copyObject



170
171
172
173
174
175
176
# File 'lib/assimp/scene.rb', line 170

def copy
  m = FFI::MemoryPointer::new(:pointer)
  Assimp::aiCopyScene(self, m)
  ptr = m.read_pointer
  raise "Could not copy scene: #{Assimp::LogStream::error_string}" if ptr.null?
  Assimp::SceneCopy::new(ptr)
end

#each_node(&block) ⇒ Object



148
149
150
151
152
153
154
155
156
# File 'lib/assimp/scene.rb', line 148

def each_node(&block)
  if block then
    node = root_node
    node.each_node(&block)
    return self
  else
    to_enum(:each_obj)
  end
end

#export(format_id, file_name, preprocessing: 0, io: nil) ⇒ Object



178
179
180
181
182
183
184
# File 'lib/assimp/scene.rb', line 178

def export(format_id, file_name, preprocessing: 0, io: nil)
  if io
    Assimp::aiExportSceneEx(self, format_id, file_name, io, preprocessing)
  else
    Assimp::aiExportScene(self, format_id, file_name, preprocessing)
  end
end

#export_to_blob(format_id, preprocessing: 0) ⇒ Object



186
187
188
189
190
# File 'lib/assimp/scene.rb', line 186

def export_to_blob(format_id, preprocessing: 0)
  ptr = Assimp::aiExportSceneToBlob(self, format_id, preprocessing)
  raise "Could not export scene: #{Assimp::LogStream::error_string}" if ptr.null?
  Assimp::ExportDataBlob::new(FFI::AutoPointer::new(ptr, Assimp::ExportDataBlob::method(:releaser)))
end

#memory_requirementsObject



164
165
166
167
168
# File 'lib/assimp/scene.rb', line 164

def memory_requirements
  m = Assimp::MemoryInfo::new
  Assimp::aiGetMemoryRequirements(self, m)
  m
end