Posted March 29, 20205 yr So, I have some GL code in a custom RenderType, which I'm using as a wrapper for an actual RenderType. My overall goal is to apply clipping to a rendered entity. rendertype1 = new ClipWrappedRenderLayer(yaw, pitch, x,y,z,progress, rendertype1); IVertexBuilder ivertexbuilder = bufferIn.getBuffer(rendertype1); renderModel(modelIn, itemStackIn, combinedLightIn, combinedOverlayIn, matrixStackIn, ivertexbuilder); public ClipWrappedRenderLayer(double pitch, double yaw, double x,double y,double z, double p, RenderType delegate) { super(MahouTsukaiMod.modId + delegate.toString() + "_with_clip", delegate.getVertexFormat(), delegate.getDrawMode(), delegate.getBufferSize(), true, delegate.func_230041_s_(), () -> { DoubleBuffer eqn1 = BufferUtils.createDoubleBuffer(8).put(new double[]{0,1,1,p}); eqn1.flip(); GL11.glClipPlane(GL11.GL_CLIP_PLANE0, eqn1); GL11.glEnable(GL11.GL_CLIP_PLANE0); delegate.setupRenderState(); }, () -> { delegate.clearRenderState(); GL11.glDisable(GL11.GL_CLIP_PLANE0); }); this.delegate = delegate; } While the clipping does happen currently, it slides with the camera as opposed to being a static clip on the entity. Is there a way I can translate/rotate this clip to where the entity will be? Nothing I've tried in the way of translation seems to do anything except clip at a slightly different angle while still following the camera. I'm assuming this setup code is called on the outside of the translation, so alternatively if there were a way to call this code on the inside of the translation, that would be good also, as that is how I did it in 1.12.2.
March 30, 20205 yr Hi I always find the order of translation-scaling-rotation-etc operations to be confusing so this might be off base, but I've usually found the trick to be either 1) put the operation in a different order (eg rotate then translate instead of translate then rotate); or 2) undo the transformation from model space to world space, perform the operation, then reapply the original transformation Not sure if that's possible (or desirable) inside your new rendertype, but it might be worth a try. -TGG
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.