New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic information on TESRs #93
Conversation
docs/tileentities/tesr.md
Outdated
|
||
### `renderTileEntityAt` | ||
|
||
This method is called every frame in order to render the tile entity. It passes the instance of the tile entity being renderered, its coordinates as doubles at the origin of the block, partialTicks<!-- I'm not actually sure what this is used for. -->, and the destroy stage of the block if being destroyed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partialTicks
is the amount of time, measured in fractions of a tick, that have passed since the last full tick. It's used for interpolating animated/moving things between ticks, so they don't look really jittery.
I think you should at least mention FastTESR. |
I've never used or looked at any implementations of FastTESR. |
docs/tileentities/tesr.md
Outdated
|
||
#### Parameters | ||
* `tileentity`: This is the instanceof the tile entity being rendered. It uses the generic argument, so, if the class is being inherited correctly, it will not need to be cast to your tile entity class. | ||
* `x`, `y`, `z`: The coordinates of the tile entity as doubles. They are at the origin of the block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is true, TESR's aren't passed world coords.
In TileEntityRendererDispatcher.renderTileEntity(TileEntity, float, int)
:
this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. You can get the world coords from the te which is probably what I confused myself with when reading my TESRs.
How should I word that then? The position of the tile entity relative to the player's view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The coordinates at which the TESR should render it's model" or something like that.
FastTESR should be listed as the preferred way to do a TESR nowadays. Only if you specifically need operations which cannot be done with purely the VertexBuffer, should you use a normal TESR. |
Can either of you provide any information on it? I've tried finding some and have been unsuccessful. The most informative thing I've found is the class itself but it doesn't have any documentation so it isn't very useful. I will list it as the preferred way to do TESRs if someone gives me the actual use case for it vs. the "normal" one and why it is the preferred way to do a TESR. Saying something is preferred without justification doesn't provide enough information/reason to use it over the thing people are already used to, as I described on a different topic at #85, and I'd prefer my PRs avoid doing that 😃 |
I'll write up something this afternoon. |
FastTESR's only advantage is that it s batched with all other FastTESR's. The stipulation of this is that the rendering code must ONLY interact with the VertexBuffer and nothing else (no GL operations). It's really that simple. |
Thank you. Diesieben's PR to my fork explained it as well. That is useful to know and is, as far as I know, not possible to find without actually digging into the rendering code. |
Add info about FastTESR and some other improvements
Any suggestions or anything needed to get this merged? |
This is by no means exhaustive, but it provides a brief introduction to TESRs and explains a few important things (like them using single-instance design).
Adds a new section, "Tile Entities", which should hopefully be expanded.