hello everyone. i trying import this 
[https://github.com/Bly7/OBJ-Loader/blob/master/Source/OBJ_Loader.h](https://github.com/Bly7/OBJ-Loader/blob/master/Source/OBJ_Loader.h)
 al day long! And nothing compiles! well, it works, but not completely. for 
example i can create loader
    
    
    
    type
      object3d=object
        objdata:Loader
    var a:object3d;
    
    Run

and even, load 3d model! 
    
    
    proc loadmesh(this: object3d, filename: string) =
      if(not this.objdata.loadfile(filename)):
        echo "error loading mesh ", filename
    a.loadmesh("cup.obj");
    
    Run

but, when i want draw object, i cant do it. I tried load the vertices using 
seq, but compiler didnt work. then i found vector for nim 
[https://github.com/3dicc/Urhonimo/blob/master/modules/container/vector.nim](https://github.com/3dicc/Urhonimo/blob/master/modules/container/vector.nim)
 and wrote this: 
    
    
     ../vector/vector
    const
      hdr = 
"\"C:\\Users\\max-5\\Documents\\lsdge\\opengl1\\libs\\objloader\\OBJ_Loader.h\""
    type
      Material* {.header: hdr, importcpp: "objl::Material".}= object
      Vector3* {.header: hdr, importcpp: "objl::Vector3".} = object
        X, Y, Z: cfloat
      Vector2 {.header: hdr, importcpp: "objl::Vector2".} = object
        X, Y: cfloat
      Vertex* {.header: hdr, importcpp: "objl::Vertex".} = object
        Position, Normal: Vector3
        TextureCoordinate: Vector2
      Loader* {.header: hdr, importcpp: "objl::Loader".} = object
        LoadedMeshes: Vector[Mesh]
      Mesh* {.header: hdr, importcpp: "objl::Mesh".} = object
        Indices: Vector[int]
        Vertices: Vector[Vertex]
        MeshName: cstring
        MeshMaterial: Material
    
    proc loadfile(this: Loader, filename: cstring): bool {.header: hdr, 
importcpp: "#.LoadFile(@)".}
    
    Run

and when i tried call some element in vector
    
    
     drawobject(this: object3d) =
      for meshindex in 0..this.objdata.LoadedMeshes.size:
        var loadedmesh:Mesh
        loadedmesh = this.objdata.LoadedMeshes.at(meshindex)#objects.nim, line 
10
    ...
    
    Run

, nothing compiles, compiler just writes `objects.nim(10, 43) Error: type 
mismatch: got <Vector[main.Mesh], uint32> but expected one of: proc at[T](this: 
var Vector[T]; index: cuint): var T for a 'var' type a variable needs to be 
passed, but 'this.objdata.LoadedMeshes' is immutable` how can i make object 
mutable, or what do i need to get vector?

Reply via email to