Module: Assimp

Extended by:
FFI::Library
Defined in:
lib/assimp/anim.rb,
lib/assimp/base.rb,
lib/assimp/defs.rb,
lib/assimp/mesh.rb,
lib/assimp/light.rb,
lib/assimp/scene.rb,
lib/assimp/types.rb,
lib/assimp/camera.rb,
lib/assimp/color4.rb,
lib/assimp/config.rb,
lib/assimp/export.rb,
lib/assimp/fileio.rb,
lib/assimp/import.rb,
lib/assimp/texture.rb,
lib/assimp/vector2.rb,
lib/assimp/vector3.rb,
lib/assimp/version.rb,
lib/assimp/material.rb,
lib/assimp/metadata.rb,
lib/assimp/matrix3x3.rb,
lib/assimp/matrix4x4.rb,
lib/assimp/quaternion.rb,
lib/assimp/postprocess.rb,
lib/assimp/importerdesc.rb

Defined Under Namespace

Modules: StructAccessors Classes: AnimMesh, Animation, Bone, Camera, Color3D, Color4D, ExportDataBlob, ExportFormatDesc, Face, File, FileIO, ImporterDesc, Light, LogStream, Material, MaterialProperty, Matrix3x3, Matrix4x4, MemoryInfo, Mesh, MeshAnim, MeshKey, MeshMorphAnim, MeshMorphKey, Metadata, MetadataEntry, Node, NodeAnim, Plane, PropertyStore, QuatKey, Quaternion, Ray, Scene, SceneCopy, String, Texel, Texture, UVTransform, Vector2D, Vector3D, VectorKey, Version, VertexWeight

Constant Summary collapse

AnimBehaviour =
enum(:anim_behavior, [
  :DEFAULT,
  :CONSTANT,
  :LINEAR,
  :REPEAT
])
MATH_PI =
3.141592653589793238462643383279
MATH_TWO_PI =
MATH_PI * 2.0
MATH_HALF_PI =
MATH_PI * 0.5
MAX_FACE_INDICES =
0x7fff
MAX_BONE_WEIGHTS =
0x7fffffff
MAX_VERTICES =
0x7fffffff
MAX_FACES =
0x7fffffff
MAX_NUMBER_OF_COLOR_SETS =
0x8
MAX_NUMBER_OF_TEXTURECOORDS =
0x8
PrimitiveType =
bitmask(:primitive_type, [
  :POINT,
  :LINE,
  :TRIANGLE,
  :POLYGON
])
MorphingMethod =
enum(:morphing_method, [
  :VERTEX_BLEND, 1,
  :MORPH_NORMALIZED, 2,
  :MORPH_RELATIVE, 3
])
LightSourceType =
enum( :light_source_type, [
  :UNDEFINED,
  :DIRECTIONAL,
  :POINT,
  :SPOT,
  :AMBIENT,
  :AREA
])
SceneFlags =
bitmask(:scene_flags, [
  :INCOMPLETE,
  :VALIDATED,
  :VALIDATION_WARNING,
  :NON_VERBOSE_FORMAT,
  :FLAGS_TERRAIN,
  :FLAGS_ALLOW_SHARED
])
Return =
enum( :return, [ :SUCCESS, :FAILURE, -1, :OUTOFMEMORY, -3 ] )
Origin =
enum( :origin, [ :SET, :CUR, :END ] )
DefaultLogStream =
bitmask( :default_log_stream, [
  :FILE,
  :STDOUT,
  :STDERR,
  :DEBUGGER
])
Components =
bitmask(:components, [
  :NORMALS, 1,
  :TANGENTS_AND_BITANGENTS,
  :COLORS,
  :TEXCOORDS,
  :BONEWEIGHTS,
  :ANIMATIONS,
  :TEXTURES,
  :LIGHTS,
  :CAMERAS,
  :MESHES,
  :MATERIALS,
  :COLORS0, 20,
  :COLORS1,
  :COLORS2,
  :COLORS3,
  :COLORS4,
  :TEXCOORDS0, 25,
  :TEXCOORDS1,
  :TEXCOORDS2,
  :TEXCOORDS3,
  :TEXCOORDS4,
  :TEXCOORDS5,
  :TEXCOORDS6,
])
UVTRAFO_SCALING =
0x1
UVTRAFO_ROTATION =
0x2
UVTRAFO_TRANSLATION =
0x4
UVTRAFO_ALL =
UVTRAFO_SCALING | UVTRAFO_ROTATION | UVTRAFO_TRANSLATION
FALSE =
0
TRUE =
1
CFlags =
bitmask(:cflags, [
  :SHARED,
  :STLPORT,
  :DEBUG,
  :NOBOOST,
  :SINGLETHREADED
])
TextureOp =
enum(:texture_op, [
  :Multiply,
  :Add,
  :Subtract,
  :Divide,
  :SmoothAdd,
  :SignedAdd
])
TextureMapMode =
enum(:texture_map_mode, [
  :Wrap,
  :Clamp,
  :Mirror,
  :Decal
])
TextureMapping =
enum(:texture_mapping, [
  :UV,
  :SPHERE,
  :CYLINDER,
  :BOX,
  :PLANE,
  :OTHER
])
TextureType =
enum(:texture_type, [
  :NONE,
  :DIFFUSE,
  :SPECULAR,
  :AMBIENT,
  :EMISSIVE,
  :HEIGHT,
  :NORMALS,
  :SHININESS,
  :OPACITY,
  :DISPLACEMENT,
  :LIGHTMAP,
  :REFLECTION,
  :UNKNOWN
])
ShadingMode =
enum(:shading_mode, [
  :Flat, 1,
  :Gouraud,
  :Phong,
  :Blinn,
  :Toon,
  :OrenNayar,
  :Minnaert,
  :CookTorrance,
  :NoShading,
  :Fresnel
])
TextureFlags =
bitmask(:texture_flags, [
  :Invert,
  :UseAlpha,
  :IgnoreAlpha
])
BlendMode =
enum(:blend_mode, [
  :Default,
  :Additive
])
PropertyTypeInfo =
enum(:property_type_info, [
  :Float, 1,
  :Double,
  :String,
  :Integer,
  :Buffer
])
MATKEY_NAME =
"?mat.name"
MATKEY_TWOSIDED =
"$mat.twosided"
MATKEY_SHADING_MODEL =
"$mat.shadingm"
MATKEY_ENABLE_WIREFRAME =
"$mat.wireframe"
MATKEY_BLEND_FUNC =
"$mat.blend"
MATKEY_OPACITY =
"$mat.opacity"
MATKEY_BUMPSCALING =
"$mat.bumpscaling"
MATKEY_SHININESS =
"$mat.shininess"
MATKEY_REFLECTIVITY =
"$mat.reflectivity"
MATKEY_SHININESS_STRENGTH =
"$mat.shinpercent"
MATKEY_REFRACTI =
"$mat.refracti"
MATKEY_COLOR_DIFFUSE =
"$clr.diffuse"
MATKEY_COLOR_AMBIENT =
"$clr.ambient"
MATKEY_COLOR_SPECULAR =
"$clr.specular"
MATKEY_COLOR_EMISSIVE =
"$clr.emissive"
MATKEY_COLOR_TRANSPARENT =
"$clr.transparent"
MATKEY_COLOR_REFLECTIVE =
"$clr.reflective"
MATKEY_GLOBAL_BACKGROUND_IMAGE =
"?bg.global"
MATKEY_TEXTURE =
"$tex.file"
MATKEY_UVWSRC =
"$tex.uvwsrc"
MATKEY_TEXOP =
"$tex.op"
MATKEY_MAPPING =
"$tex.mapping"
MATKEY_TEXBLEND =
"$tex.blend"
MATKEY_MAPPINGMODE_U =
"$tex.mapmodeu"
MATKEY_MAPPINGMODE_V =
"$tex.mapmodev"
MATKEY_MAPPINGMODE_W =
"$tex.mapmodew"
MATKEY_TEXMAP_AXIS =
"$tex.mapaxis"
MATKEY_UVTRANSFORM =
"$tex.uvtrafo"
MATKEY_TEXFLAGS =
"$tex.flags"
MetadataType =
enum(:metadata_type, [
  :BOOL,
  :INT32,
  :UINT64,
  :FLOAT,
  :DOUBLE,
  :AISTRING,
  :AIVECTOR3D
])
PostProcessSteps =
bitmask(:post_process_steps, [
  :CalcTangentSpace,
  :JoinIdenticalVertices,
  :MakeLeftHanded,
  :Triangulate,
  :RemoveComponent,
  :GenNormals,
  :GenSmoothNormals,
  :SplitLargeMeshes,
  :PreTransformVertices,
  :LimitBoneWeights,
  :ValidateDataStructure,
  :ImproveCacheLocality,
  :RemoveRedundantMaterials,
  :FixInfacingNormals,
  :SortByPType, 15,
  :FindDegenerates,
  :FindInvalidData,
  :GenUVCoords,
  :TransformUVCoords,
  :FindInstances,
  :OptimizeMeshes,
  :OptimizeGraph,
  :FlipUVs,
  :FlipWindingOrder,
  :SplitByBoneCount,
  :Debone,
  :GlobalScale
])
ProcessPreset_ConvertToLeftHanded =
ProcessPreset_TargetRealtime_Fast =
ProcessPreset_TargetRealtime_Quality =
ProcessPreset_TargetRealtime_MaxQuality =
ImporterFlags =
bitmask(:importer_flags, [
  :SupportTextFlavour,
  :SupportBinaryFlavour,
  :SupportCompressedFlavour,
  :LimitedSupport,
  :Experimental
])

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compile_flagsObject



48
49
50
# File 'lib/assimp/version.rb', line 48

def self.compile_flags
  Assimp::aiGetCompileFlags
end

.export_format_descriptionsObject



22
23
24
25
26
27
# File 'lib/assimp/export.rb', line 22

def self.export_format_descriptions
  count = Assimp::aiGetExportFormatCount
  count.times.collect { |i|
    Assimp::aiGetExportFormatDescription(i)
  }
end

.extension_listObject



246
247
248
249
250
# File 'lib/assimp/import.rb', line 246

def self.extension_list
  s = String::new
  Assimp::aiGetExtensionList(s)
  s
end

.extension_supported?(extension) ⇒ Boolean

Returns:

  • (Boolean)


240
241
242
# File 'lib/assimp/import.rb', line 240

def self.extension_supported?(extension)
  Assimp::aiIsExtensionSupported(extension)
end

.import_file(file, flags: 0, fs: nil, props: nil) ⇒ Object



214
215
216
217
218
219
220
221
222
# File 'lib/assimp/import.rb', line 214

def self.import_file(file, flags: 0, fs: nil, props: nil)
  if props
    s = Assimp::aiImportFileExWithProperties(file, flags, fs, props)
  else
    s = Assimp::aiImportFileEx(file, flags, fs)
  end
  raise "Could not load model #{file}: #{Assimp::LogStream::error_string}!" if s.pointer.null?
  s
end

.import_file_from_memory(buffer, flags: 0, hint: "", props: nil) ⇒ Object



227
228
229
230
231
232
233
234
235
# File 'lib/assimp/import.rb', line 227

def self.import_file_from_memory(buffer, flags: 0, hint: "", props: nil)
  if props
    s = Assimp::aiImportFileFromMemoryWithProperties(buffer, buffer.size, flags, hint, props)
  else
    s = Assimp::aiImportFileFromMemory(buffer, buffer.size, flags, hint)
  end
  raise "Could not load model: #{Assimp::LogStream::error_string}!" if s.pointer.null?
  s
end

.import_format_descriptionsObject



267
268
269
270
# File 'lib/assimp/import.rb', line 267

def self.import_format_descriptions
  count = Assimp::aiGetImportFormatCount
  count.times.collect { |i| aiGetImportFormatDescription(i) }
end


34
35
36
# File 'lib/assimp/version.rb', line 34

def self.legal_string
  Assimp::aiGetLegalString
end

.versionObject



30
31
32
# File 'lib/assimp/version.rb', line 30

def self.version
  Version::new Assimp::aiGetVersionMajor, Assimp::aiGetVersionMinor, Assimp::aiGetVersionRevision
end

Instance Method Details

#deg_to_rad(x) ⇒ Object



20
21
22
# File 'lib/assimp/defs.rb', line 20

def deg_to_rad(x)
  x * 0.0174532925
end

#rad_to_deg(x) ⇒ Object



24
25
26
# File 'lib/assimp/defs.rb', line 24

def rad_to_deg(x)
  x * 57.2957795
end