AEModernMCPort / Applied-Energistics-3-Fork

A Minecraft Mod about Matter, Energy and using them to conquer the world..
http://ae-mod.info/
Other
37 stars 12 forks source link

Implemented Glass Blocks #51

Closed shartte closed 8 years ago

shartte commented 8 years ago

This one is more complicated than the previous PRs, since I couldn't replicate the original rendering code using JSON models. Instead I used a custom IBakedModel / ICustomModelLoader that dynamically bakes a model based on extended block state that comes from the glass blocks.

The old rendering code employed an offset-map that slightly shifts the glass texture based on x,y,z position. Which is one of the things making it very hard to replicate with pure JSON models.

Instead of drawing smaller quads for each border-segment, I chose to go with one texture per possible border segment placement (16 total). Using the old approach caused some z-fighting at the corners, where two quads would overlap.

There is still some major optimization potential for the baking itself, but rendering performance - due to the baking - should already be as good as it'll get.

Visual result: Glass Blocks Glass Blocks

Elix-x commented 8 years ago

Loader is in order to load models. This is not the case. Use IBakedModel implementation directly.

shartte commented 8 years ago

How would I expose the IBakedModel to the rest of the system? We're still going strictly through the official APIs this way.

btw: I got this aproach from McJty's modding tutorials. Not to mention it's the same approach Forge itself uses for ModelDynBucket. It registers a custom model loader that always returns the same model instance.

Elix-x commented 8 years ago

And what is registerCustomModelOverride in defs for?

shartte commented 8 years ago

That is post-bake and means you still have to load all required textures by hand beforehand. This way ensures the model is handled the normal way, meaning all required textures are loaded and stitched by Minecraft without any special logic. I don't quite understand why you're so opposed to using a custom model loader this way? I've seen similar approaches in other game engines, where a loader is used to expose built-in models as if they were on-disk models.

Elix-x commented 8 years ago

Ok, i'll keep it this way till i commit cables (which contain a way of registering textures manually).

shartte commented 8 years ago

As with the controllers: We could merge, and make an issue that contains the TODO of porting the registration code for this to the new system once it comes in. Could even assign it to me directly if you want.

dpeter99 commented 8 years ago

Can I merge this? @elix-x

Elix-x commented 8 years ago

@shartte you're responsible for moving it to ibaked once time will come.

Elix-x commented 8 years ago

Reverted in https://github.com/AEModernMCPort/Applied-Energistics-2/commit/0c4cb295f3ffbb9ef76fd458f9e6ebae39fe71c0.