Class: ASSIMP::Importer

Inherits:
Object
  • Object
show all
Defined in:
ext/assimp/assimp_importer.c

Instance Method Summary collapse

Constructor Details

#initializeObject



3
4
5
6
# File 'ext/assimp/assimp_importer.c', line 3

static VALUE initialize(VALUE self)
{
  return self;
}

Instance Method Details

#read_file(args) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'ext/assimp/assimp_importer.c', line 64

static VALUE read_file(VALUE self, VALUE args)
{
  char * file_str;
  struct aiScene * scene;
  unsigned int flags;
  long num_args;
  VALUE file_name, result;
  flags = 0;
  num_args = RARRAY_LEN(args);
  result = Qnil;

  if(num_args > 2 || num_args < 1)
    rb_raise(rb_eArgError, "wrong number of arguments");

  file_name = rb_ary_entry(args, 0);
  Check_Type(file_name, T_STRING); 
  file_str = StringValueCStr(file_name);

  if(num_args > 1)
    flags = get_flags(rb_ary_entry(args, 1));

  scene = aiImportFile(file_str, flags);

  if(!scene)
    rb_raise(rb_eIOError, aiGetErrorString());
  else{
    result = get_Hash_from_aiScene(scene);
    aiReleaseImport(scene);
    return result;
  }
}