greenfork / nimraylib_now

The Ultimate Raylib gaming library wrapper for Nim
MIT License
151 stars 17 forks source link

Vector3 is not a Vector3 ?? #90

Closed suncore closed 1 year ago

suncore commented 1 year ago

Hi! I'm trying to run an example but a get a build error:

nimraylib_now/examples/shaders$ nim c -r -d:release --gc:orc shaders_basic_lighting.nim 
Hint: used config file '/home/hch/.choosenim/toolchains/nim-1.6.10/config/nim.cfg' [Conf]
Hint: used config file '/home/hch/.choosenim/toolchains/nim-1.6.10/config/config.nims' [Conf]
.........................................................................................
/home/hch/.nimble/pkgs/nimraylib_now-0.15.0/nimraylib_now/static_build.nim(4, 1) Hint: duplicate import of 'os'; previous import here: /home/hch/.nimble/pkgs/nimraylib_now-0.15.0/nimraylib_now/mangled/raylib.nim(6, 6) [DuplicateModuleImport]
..............
/a/proj/oc/nimraylib_now/src/nimraylib_now/static_build.nim(4, 1) Hint: duplicate import of 'os'; previous import here: /a/proj/oc/nimraylib_now/src/nimraylib_now/mangled/raylib.nim(6, 6) [DuplicateModuleImport]
.........
/a/proj/oc/nimraylib_now/examples/shaders/shaders_basic_lighting.nim(78, 24) Error: type mismatch: got <LightType, (float64, float64, float64), Vector3, Color, Shader>
but expected one of:
proc createLight(type: cint; position: Vector3; target: Vector3; color: Color;
                 shader: Shader): Light
  first type mismatch at position: 3
  required type for target: Vector3
  but expression 'vector3Zero()' is of type: Vector3

expression: createLight(POINT, (4.0, 2.0, 4.0), vector3Zero(), White, shader)

I'm new to nim and nimraylib_now so I don't understand what is wrong here. It is complaining that a Vector3 is needed but it is getting a Vector3....??

I'm using nim 1.6.10.

greenfork commented 1 year ago

Hi, why do you have different directories in your output?

/home/hch/.nimble/pkgs/nimraylib_now-0.15.0/nimraylib_now/static_build.nim

/a/proj/oc/nimraylib_now/src/nimraylib_now/static_build.nim

By the way, the example doesn't seem to be fully functional, the light is not reflected on the shapes' surfaces.

suncore commented 1 year ago

I installed nimraylib_now using nimble install nimraylib_now Then I cloned this repo from github to get the examples. I guess that is why the directories differ.

greenfork commented 1 year ago

Do you use NixOS, GuixSD or something like this? Why is /a/proj prefixed with a, I wonder? Which OS do you use?

Also, false alarm on the example, it works if I'm in the same directory as the example file.

suncore commented 1 year ago

I'm using Kubuntu 22.10."/a" is just a top level mount point for all my data from the NAS.

Should I try to not use nimble to install nimraylib_now in some way so I get the same git clone for both the nimraylib_now code and examples? I can try to get through the examples in the HACKING document. I just don't understand the weird error output from the nim compiler...

greenfork commented 1 year ago

Got it. I have reproduced the issue, it was the problem with the path inside rlights.nim. I have pushed the fix https://github.com/greenfork/nimraylib_now/commit/aae82c69e02b5fb40c96deecde4896ca92f94907, please do git pull and it should work now.

suncore commented 1 year ago

It works now. Thanks!