A lost block needs your help

DPirate

New Member
Hello All,
I am a block who was supposed to be generated one of these days but got lost(already!!) T^T , hence here I am, asking for any noble and wise soul out there to explain me the journey a block has to undergo through Terasology code-base from getting generated to finally getting rendered . The classes/groups of classes one has has to encounter (in a tree like fashion ?) -along with some brief snippets regarding them . I do hope to learn a lot along this journey and see the bright Sun one day (I have a feeling I am one of the surface blocks).
 

manu3d

Active Member
Contributor
Architecture
Render-side I can think of classes WorldRendererImpl and RenderableWorldImpl as your starting point. Data-side you should look into ChunkProvider implementations and perhaps also WorldProvider. I can answer a good number of questions render-side, much less so data-side. You might also want to check the World Generation Tutorial on the wiki.
 

DPirate

New Member
Hi @manu3d ,
I did check the wiki. Could name the nodes which let generating part interact with rendering part? Where the actual rendering happens(initiated, shaders compiled)? And suppose I need to getLight at a particular position how is it gonna happen?
 
Last edited:

manu3d

Active Member
Contributor
Architecture
Let me put it this way: the "generating part" generates the data to be rendered. The "rendering part" renders it. The way they interact is through the data, not directly calling each other. In terms of nodes, the OpaqueBlocksNode and the AlphaRejectBlocksNode are some of the nodes rendering blocks.

Regarding getLight, you can use WorldRenderer.getMainLightIntensityAt(position) and WorldRenderer.getRenderingLightIntensityAt(position). The first gives you the light intensity caused by the sun/moon. The second takes in account light sources such as torches. Please look at the implementation in WorldRendererImpl for the details.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Those just store block id values so each chunk knows what it contains :)

I can't advise on the rendering itself much, but you may have more luck getting some live assistance on IRC, depending on time of day (European evenings tend to be best)
 
Top