sebastian.vesenmayer Posted February 17, 2022 Share Posted February 17, 2022 (edited) Hello, we want to share a mesh object with DecalMeshes but it crashes, when we call the setMesh method with the second parameter 0 in Unigine 2.14.1. We can reproduce this in 2.15 as well. The documentation on this class is also incomplete for 2.15 and API changes have not been documented. How can we achieve to alter the mesh object and get the updates to the decal mesh object? Find a reproducer below. Thanks #include "AppWorldLogic.h" #include <UnigineObjects.h> #include <UnigineDecals.h> #include <UnigineMaterials.h> using namespace Unigine; // World logic, it takes effect only when the world is loaded. // These methods are called right after corresponding world script's (UnigineScript) methods. AppWorldLogic::AppWorldLogic() { } AppWorldLogic::~AppWorldLogic() { } static MeshPtr mesh; static DecalMeshPtr decalMesh; static ObjectMeshStaticPtr objMesh; int AppWorldLogic::init() { // Write here code to be called on world initialization: initialize resources for your world scene during the world start. // Write here code to be called on world initialization: initialize resources for your world scene during the world start. // create an empty decal mesh decalMesh = DecalMesh::create(); // create a mesh mesh = Mesh::create(); mesh->addSurface(); mesh->addVertex(Unigine::Math::vec3(0.f, 0.f, 1.f), 0); mesh->addVertex(Unigine::Math::vec3(1.f, 0.f, 1.f), 0); mesh->addVertex(Unigine::Math::vec3(1.f, 1.f, 1.f), 0); mesh->addVertex(Unigine::Math::vec3(0.f, 1.f, 1.f), 0); mesh->addIndex(0, 0); mesh->addIndex(1, 0); mesh->addIndex(2, 0); mesh->addIndex(2, 0); mesh->addIndex(3, 0); mesh->addIndex(0, 0); mesh->createTangents(); mesh->createBounds(); // copy the mesh into the decal mesh decalMesh->setMaterial(Unigine::Materials::findManualMaterial("Unigine::decal_base")); decalMesh->setRadius(8.f); //decalMesh->setMesh(mesh, 1);// works decalMesh->setMesh(mesh, 0); //crashes with nullptr exception in MeshStatic::setMesh Line 129 return 1; } Edited February 17, 2022 by sebastian.vesenmayer Link to comment
silent Posted February 18, 2022 Share Posted February 18, 2022 Hi Sebastian, Thank you for the bug report. This bug fix would be available in the upcoming 2.15.1 update. At the meantime you can try to use DecalMesh constructor instead of setMesh(). 1 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
fox Posted February 18, 2022 Share Posted February 18, 2022 Hi Sebastian, As for this point: 19 hours ago, sebastian.vesenmayer said: The documentation on this class is also incomplete for 2.15 and API changes have not been documented. We'll update code snippets in the docs, as there is an old constructor used there (with parameters), other than that the article on the DecalMesh class seems to be up-to-date. Sorry for any inconvenience caused. If there is other "incompleteness" regarding this class, please let us know. Thank you! 1 Link to comment
sebastian.vesenmayer Posted February 18, 2022 Author Share Posted February 18, 2022 (edited) Hi @fox in your latest update (2.15) the Constructor was changed from "create" to "DecalMesh()" which is not correct I think. https://developer.unigine.com/en/docs/2.15/api/library/decals/class.decalmesh?rlang=cpp Edited February 18, 2022 by sebastian.vesenmayer Link to comment
fox Posted February 18, 2022 Share Posted February 18, 2022 Hi Sebastian, I see, this was a missing flag in method description, causing a failure of the automatic name converter for constructors in the API docs. Fixed, now Decal constructors should be displayed properly. Thanks for reporting! Link to comment
Recommended Posts