Jump to content

Recommended Posts

Posted

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
  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Posted
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
  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Posted

Your code should handle the case whdd Ed n it returns -1. Pivots and as my other nonvvisible will return -1

  • Thanks 1

Let's build cool stuff and have fun. :)

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.

×
×
  • Create New...