Jump to content

[1.8]Bindtexture affects JSON model


FLUFFY2

Recommended Posts

Hello guys,

I come up with an idea that i can render additional models within the IPerspectiveModelAware handlePerspective method.

 

It does work, i can render both models, rotate them independetly and such.

Just that when i bind the texture to the additional model, it also binds the texture to the JSON model.

@Override
public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
	switch(cameraTransformType){
	case FIRST_PERSON:
		this.customModel();
		RenderItem.applyVanillaTransform(BaseModel.getItemCameraTransforms().firstPerson);
                        //Rebind texture with BaseModel.getTexture somehow??
		return Pair.of(BaseModel,  null);
}

public void customModel(){
	Minecraft mc = Minecraft.getMinecraft();

	GlStateManager.pushMatrix();
	GlStateManager.rotate(20F, 0F, 1F, 0F);
	GlStateManager.rotate(-80F, 0F, 0F, 1F);
	GlStateManager.translate(-0.15F, -0.82F, 0F);
	GlStateManager.scale(0.9F, 1.3F, 0.9F);

//TEXTURE BIND TO CUSTOM MODEL
mc.getTextureManager().bindTexture(mc.getMinecraft().thePlayer.getLocationSkin());
	//RENDER CUSTOM MODEL(hidden)
	GlStateManager.popMatrix();
}

 

So how can i bind the texture only to the custom model, or how can i rebind the texture to the json model?

Since my model has multiple textures i cannot use bindTexture because only the last texture applies.

Link to comment
Share on other sites

I have to use GL, because the system is horribly s*it.

 

If i use a merged model, where i merge it to the base model, i cannot do independent transform, and i cannot use the player.getLocotionSkin on it.

 

If i use RenderHandEvent, all the additional models arent jammed to the player view, and its just too much of a hassle to get all those private fields. And no, itemRenderer.renderItem(), not works coz i want to render something else.

 

This method below works and i dont want to bind the texture to the IBakedModel.

The other model isnt an IBakedModel, its the players arm.

I made the first kinda working first person arm for 1.8, and this little thing is in the way

 

So if you can help, how can i bind a texture to a certain model only?

Like:

bindTexture;

renderModel;

stopBindTexture;

Link to comment
Share on other sites

Do NOT make GL calls inside the model code... If you are using an IBakedModel it must use a texture that is on the big texture sheet.

 

GL calls and bind texture are two different things. I have used GL in model code, never hurt it one bit. Forge makes GL calls when handlePerspective() is called getting the Pair matrix that should be added to the GL state before rendering.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

This sounds like a horrible idea, but oh well. You are a modder, modders always do stupid shit apparently.

 

If it fixes the problem and doesn't effect performance, aesthetics (in a bad way), and / or doesn't disrupt the rendering process in any way (GL calls can be made in model code), why is that stupid xD? It works. Effectively. This is modders working with the new rendering system.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

diesieben look, i can tell you how you cant achieve this without my method.

 

ISmartItemModel:

1.BaseModel and Arm model is merged together and renders correctly.

2.You cannot set independent transform.

3.You cannot use player.getLocotionSkin() to bind the player arm skin to the json model. You cannot pull the .png out nowhere.

 

The Arm is actually part of the BaseModel:

1.You still cannot bind the player skin to the arm dynamically.

 

RednerHandEvent:

1.You render the arm moder with a method inside RenderPlayer.

2.You can bind the texture to it.

3.You can set independent transform to it.

4.You CANNOT jam it to the item model. There is too much private method you need to reflect or copy.

So its not efficent.

 

My method(IPersPectiveModelAware):

1.You can render the arm with the RenderPlayer method, only in first person.

2.You can bind the player skin to it.

3.You can do independent transform.

4.I didnt notice any FPS drop.

 

So in conclusion, this is the only way to do first person arm rendering now.

I tried everything and this is the simplest way.

Not only you can render the player first person arm, you can do many more what ISmartItemModel cant or it can but its way over complicated.

 

 

 

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
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.