Jump to content

Recommended Posts

Posted

I can't seem to figure out or find a source to know if I can have more than 2 render passes (pass 0 and 1), 0 for opaque textures, 1 for transparent.

 

My goal is to have a semi-transparent texture, and then an overlayed texture that will rotate between states much like Thermal Expansion.

 

If I set the render pass for 2, then the renderer never seems to get there, it stops at 1 which is when I render my semi-Transparent texture, and then it never renders the overlay to that.

 

@Override
    public IIcon getTexture(int side, int pass)
    {
        if(pass == 0)
        {
            return IconRegistry.getIcon("Cell_Side_0");
        }
        if(pass == 1)
        {
            if(side <= 1)
                return IconRegistry.getIcon("Cell_Top_Red");
            else
                return IconRegistry.getIcon("Cell_Side_Red");
        }
        if(side < 6){
            return IconRegistry.getIcon("Cell_Side_" + this.getSendRecv(side));
        }

        return null;
    }

 

@Override
    public boolean canRenderInPass(int pass)
    {
        renderPass = pass;
        return true;
    }

    @Override
    public int getRenderBlockPass()
    {
        return renderPass;
    }

Posted

That:

    @Override
    public int getRenderBlockPass()
    {
        return renderPass;
    }

Is not what that is for.  That function is supposed to return which pass the block renders in, not what pass the rendering is on.  Basically, Vanilla is asking your block what pass it needs to render in, you return a 0 (default value for an unassigned integer), which it then goes on to render a Pass 0 and a Pass 1 (your block cheating and getting both) and then finishes with having done two passes (leaving a 1 stored in renderPass, so the next time that getter will return 1, having changed nothing).

 

If you need a third, make that function return 2.

 

IIRC that will cause the Vanilla code to see that "at least one block" requires a third pass and will loop through an extra time.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Hi

 

If you need a third, make that function return 2.

 

IIRC that will cause the Vanilla code to see that "at least one block" requires a third pass and will loop through an extra time.

Unfortunately that doesn't seem to be true for 1.7, I think you're right that it was possible in 1.6 but it's been eliminated, the renderer only ever performs pass 0 and 1, and it skips pass 1 if getRenderBlockPass() doesn't return >=1.

 

I can only suggest a few things

- if you use a TileEntitySpecialRenderer, you can render as many layers as you want.

- It also used to be possible to use an ISBRH to stop and restart the tessellator after changing the drawing modes (did it myself in 1.6), but I have heard rumours that leads to errors in 1.7 - haven't tried it myself.

- Failing those, you could perhaps add a third rendering layer yourself, perhaps RenderWorldLastEvent would a suitable point, otherwise you would probably need to insert your rendering code using ASM (eg into RenderGlobal.renderSortedRenderers()).  This would be pretty challenging I think...

 

-TGG

 

 

 

 

 

 

Posted

If you need a third, make that function return 2.

 

IIRC that will cause the Vanilla code to see that "at least one block" requires a third pass and will loop through an extra time.

Unfortunately that doesn't seem to be true for 1.7, I think you're right that it was possible in 1.6 but it's been eliminated, the renderer only ever performs pass 0 and 1, and it skips pass 1 if getRenderBlockPass() doesn't return >=1.

 

Aw that's a bummer.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I can only suggest a few things

- if you use a TileEntitySpecialRenderer, you can render as many layers as you want.

- It also used to be possible to use an ISBRH to stop and restart the tessellator after changing the drawing modes (did it myself in 1.6), but I have heard rumours that leads to errors in 1.7 - haven't tried it myself.

- Failing those, you could perhaps add a third rendering layer yourself, perhaps RenderWorldLastEvent would a suitable point, otherwise you would probably need to insert your rendering code using ASM (eg into RenderGlobal.renderSortedRenderers()).  This would be pretty challenging I think...

 

-TGG

 

Thank you for the suggestions.

 

Can you point me in the direction of a good tutorial for using the TileEntitySpecialRenderer?

Posted

Thank you for the suggestions.

 

Can you point me in the direction of a good tutorial for using the TileEntitySpecialRenderer?

Not yet :)

I'm planning on making one in a while, haven't gotten to it yet and I don't know of one.  The vanilla TESR are not too bad to understand.  I have found MrCrayfish's furniture mod very helpful and it has TESR in it

https://github.com/MrCrayfish/MrCrayfishFurnitureMod

 

 

-TGG

 

Posted

Well that didn't really help too much.

 

I'm pretty rookie when it comes to rendering.

I don't quite understand the difference between using the ISimpleRenderingHandler and the TileEntitySpecialRenderer and when to use them.

 

I'm just trying to render a standard block(1m x 1m x 1m), but overlay my textures and I can't figure out how to complete that with either the RenderBlocks or the Tesselator.

 

Edit: I have to specify, my textures are in separate files. i.e. RedCell_Side.png(semi-transparent) and RedCell_in.png(Overlain texture)

 

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.