Jump to content

GetEntityIndex()


SpiderPig
 Share

Recommended Posts

What i have found, is that the IDs are stored in the Render... classes, RenderMaterial, RenderTexture, etc. . These are all stored in private properties. There is a hackish way to access them (creating a separate class and modifying the original headers) but with every update this will be overwritten.

I would like to add also Texture ID access, which might be useful for PostEffects. 

Maybe some static class extensions for the IDSystem like

IDSystem::GetMaterialID(mat) 

IDSystem::GetTextureID(tex)

...

  • Like 1
  • Upvote 1
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

3 hours ago, SpiderPig said:

Unless there's already a way to do this?

This is the hacky way without direct header access, but which needs to be updated when the class structure changes:

struct PublicMaterial : public Asset
{
    // copy everything from Material.h Material class here
	// remove the access modifier
	// remove all methods/constructors and friend functions
};

// Call this in your loop
auto refmat = (*sample_material);
auto mat = reinterpret_cast<PublicMaterial*>(&refmat);
auto materialId = mat->rendermaterial->id;

 

  • Like 1
  • Thanks 1
  • Sad 1
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...