Skip to content

Need a little help porting an example... #7

@Skaruts

Description

@Skaruts

I was trying to port the first person maze example, and came across this:

Model model = LoadModelFromMesh(mesh);
//(...)
model.materials[0].maps[MAP_DIFFUSE].texture = texture;             // Set map diffuse texture

And I'm not being able to translate that second line there, because it involves C array pointers, and I don't quite know how to work with those in Nim.
Someone suggested that I use UncheckedArrays, and I used that successfully with Image data in another example, but here I'm not managing to. I tried this but didn't work:

var mats = cast[ptr UncheckedArray[Material]](model.materials)
var maps = cast[ptr UncheckedArray[MaterialMap]](mats[0])         # <--- line 42
maps[MAP_DIFFUSE].texture = texture                  
... first_person_maze.nim(42, 15) Error: expression cannot be cast to ptr UncheckedArray[MaterialMap]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions