Skip to content

Bug: Inconsistent Material API when using DOUBLE_PRECISION #5701

Closed

Description

@larioteo

Describe the bug
This bug was initially discovered two years ago, and now I had the luck to discover it again. Either way, I have more details on the bug, so I thought, let's start a new fresh issue for it.

I added below the code lines that I tracked down. As you see in material.h, there is float* specified as argument, while in the material.inl and MaterialSystem.cpp, ai_real* is specified as argument. So the project is not able to compile under double precision.

Also, this should be more of an issue if you look at the definition of aiColor4D:
image
which is always a float. So the API is rather broken in my opinion. I first replaced the float* to ai_real*, which corrupted the stack..., now I know why.

Simple replacing it with float*, doesn't work that easily. For that, I would need a lot more time to understand everything, which is not feasible, sorry.

Link to similar issue: #4685
(There was also a fix attached below, which never got merged, I don't know if it is the right solution to this problem.)

To Reproduce
Steps to reproduce the behavior:
Simply build with ASSIMP_DOUBLE_PRECISION enabled using VS2022 17.11 Preview 6. I am using a custom premake5 build for assimp, but it's clear that the fault is in the code, not the build itself.

Expected behavior
It should compile if you enable double precision.

Platform (please complete the following information):

  • OS: Windows 11
  • Version: 23H2

Additional context
Affected code:

Activity

  1. added
    Bug
    on Aug 6, 2024
  2. sagaceilo commented on Aug 8, 2024

    @sagaceilo

    Tried today it not even compile with ASSIMP_DOUBLE_PRECISION. Throwing a bunch of errors with msimatched implementation of many aiMaterial functions.

    Probably broken with: da281b7

  3. kimkulling commented on Nov 29, 2024

    @kimkulling
    Member

    Closed by #5902

  4. added
    API
    on Nov 29, 2024
  5. added
    Precision
    on May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIBugPrecision

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions