Jump to content

Help me with TESR


Mambo_Dancer

Recommended Posts

Help sos pls

with my TESR class

when im placing my InfusionAltar, all particles are disapearing, and >2 altars dont want to render, and speed of spinning and hovering are too dam fast, help pls

https://github.com/MamboDancer/minecraftmod/tree/master/src/main/java/ua/mambodancer/theterrifyingbeats/blocks/tileentities - link to problem code (TESRAltar)

Edited by Mambo_Dancer
Link to comment
Share on other sites

55 minutes ago, Mambo_Dancer said:

when im placing my InfusionAltar my another entity, that should hovering above is stucks to me 

What?

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.

Link to comment
Share on other sites

You are rendering your item outside the pushed matrix. Move it to be rendered inside of it.

TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile.

I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist.

An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL.


I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

11 minutes ago, Matryoshika said:

You are rendering your item outside the pushed matrix. Move it to be rendered inside of it.

TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile.

I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist.

An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL.


I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour.

thanks alot, but most of it seems to be hard to understand coz im a beginner, i will appreciate any help with undoing as example

Link to comment
Share on other sites

36 minutes ago, Matryoshika said:

You are rendering your item outside the pushed matrix. Move it to be rendered inside of it.

TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile.

I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist.

An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL.


I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour.

Still cant get rid of no particles, moved to inside matrix (x=0,y=0.4,z=0) and trouble still in

Link to comment
Share on other sites

54 minutes ago, Matryoshika said:

You are rendering your item outside the pushed matrix. Move it to be rendered inside of it.

TESR's are also singletons. There is only one TESR that does the work for rendering every single tile-entity that it is bound to. If there are several loaded at the same time, then you need to compensate the rotation, either by using a variable from the TE itself, or any other "outside" data, otherwise it'll speed up by +1x times for each tile.

I would also recommend that you start to undo whatever you rendered after you are done. "Artifacts" are a type of behaviour when rendering isn't stopped once you think it has, and starts interfering with other's rendering. OpenGL artifacts are annoying and hard to track down. GLStateManager helps out a bit, but in the end artifacts shouldn't exist.

An example of "undoing" would be to translate your TESR to where you want it, render the item, then translate again with negative values, to reset it. This goes for every action you do with OpenGL.


I have a TESR that spins in all axii, as well as bobbing up and down here. You can take a look and see where your code differentiates. Do note, I'm calling other methods as well so a pure copy/paste will lead to unintended behaviour.

and i will be very happy if you help me with that fast rotation, cant get rid of it too((

Link to comment
Share on other sites

  1. You are constantly creating a new EntityItem every frame. These will stack up, and just cause excessive cleanup for the GarbageCollector (which cleans up used memory).
    Declare a final EntityItem outside the method and just reference whenever you want to render.
  2. You are completely missing a pushMatrix call.
  3. You need to revert the rotation & the translation after you have rendered the EntityItem 

An example of reverting the rotation would be as I did in my code I linked earlier
 

    	GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything
    	renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing
    	GlStateManager.rotate(-angle, 1, 1, 1); //reverting the rotation with an equal but negative angle

 

If you want to use the same logic as I do for calculating the angle, then instead of multiplying by 100 (what you changed) you should divide by a larger number than 40 (what I used).

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

Just now, Matryoshika said:
  1. You are constantly creating a new EntityItem every frame. These will stack up, and just cause excessive cleanup for the GarbageCollector (which cleans up used memory).
    Declare a final EntityItem outside the method and just reference whenever you want to render.
  2. You are completely missing a pushMatrix call.
  3. You need to revert the rotation & the translation after you have rendered the EntityItem 

An example of reverting the rotation would be as I did in my code I linked earlier
 


    	GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything
    	renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing
    	GlStateManager.rotate(-angle, 1, 1, 1); //reverting the rotation with an equal but negative angle

 

If you want to use the same logic as I do for calculating the angle (but slow it down), then instead of multiplying by 100 (what you changed) you should divide by a larger number than 40 (what I used).

 

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

13 minutes ago, Matryoshika said:

GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything

renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing

GlStateManager.rotate(-angle, 1, 1, 1); //reverting the rotation with an equal but negative angle

This is what pushMatrix and popMatrix do.

GLStateManager.pushMatrix();
GlStateManager.rotate(angle, 1, 1, 1); //Rotating everything
renderBody(te, x, y, z, partialTicks, destroyStage); //render the thing
GLStateManager.popMatrix(); //undo to the last pushMatrix

 

 

Edited by Draco18s

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.

Link to comment
Share on other sites

17 minutes ago, Matryoshika said:

 

so it worked, particularry, it doesnt want to rotate, and i have annoying name hovering above block when u lookng on block (container.infusionaltar) tried to look where it is called but my mission failed)
i do not know about forge modding so much stuff, could you recommend me some stuff where i can learn more about? thanks for help btw

Link to comment
Share on other sites

On 12-3-2018 at 10:47 PM, Mambo_Dancer said:

so it worked, particularry, it doesnt want to rotate, and i have annoying name hovering above block when u lookng on block (container.infusionaltar) tried to look where it is called but my mission failed)
i do not know about forge modding so much stuff, could you recommend me some stuff where i can learn more about? thanks for help btw

Heya, i have taken a quick look at your TESR and you are setting the value in the render method, I would recommenced you to do this for example in the update method in your tileEntity (to update the value) and make setters and getters for that value in your tile.

So then you can call this from your TESR.

But you should also take care of the latency.

Example to explain better :P :

tile.getModelAngle() * partialTickTime  <- if you are actually rotating the model

and if the data (angle) doesn't change you give it just the tile.getModelAngle()

 

real example : 

float rotation = tile.isModelRotating() ? tile.getModelAngle() + (tile.getModelAngle() - tile.getModelPrevAngle()) *partialTickTime : tile.getModelPrevAngle() + ( tile.getModelAngle() - tile.getModelPrevAngle());
GlStateManager.rotate(rotation, 0, 0, 1);

 

Hope this helps you somehow.

 

(NOTE: TESR is as far as i know multi-threaded meaning the same render method is called in "independent" threads so your "angle" in the TESR will have different values, cuss the different threads don't share there values/data to each other.

So your rotation will always be broke.

And the render method is only called when the player is actually looking at the block/tile, so is not rotating which is fine if it's just for aesthetic purpose ) 

 

Greets Sir_titi

Edited by sir_titi

Always looking for new challenges, and happy to help the people where ever I can

Link to comment
Share on other sites

3 minutes ago, sir_titi said:

(NOTE: TESR is as far as i know multi-threaded meaning the same render method is called in "independent" threads so your "angle" in the TESR will have different values, cuss the different threads don't share there values/data to each other.

What? This is literally nonsense.

"Two instances of the class" and "two threads" are completely and utterly different concepts.

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.

Link to comment
Share on other sites

1 minute ago, Draco18s said:

What? This is literally nonsense.

"Two instances of the class" and "two threads" are completely and utterly different concepts.

Wait what do you mean?

Sorry me for being stupid :P

Always looking for new challenges, and happy to help the people where ever I can

Link to comment
Share on other sites

46 minutes ago, sir_titi said:

Wait what do you mean?

Sorry me for being stupid :P

https://en.wikipedia.org/wiki/Multithreading_(computer_architecture)

 

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.

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.