4 ms·
Same here. It’d also be great if the variables were a bit easier to interpret.
by g00gler 9y ago
Same here. It’d also be great if the variables were a bit easier to interpret.
- _cwolf 9y agoI'll see what I can do.
- rocky1138 9y agoIs there any reason why most of these 3d engines use one-letter variable names?
- ramses0 9y agoBecause 'x' is easier to type than "getHorizontalScreenSpacePixelPositionRelativeToBottomLeftCorner()" ?
- jjjensen90 9y agoWhile true, you end up reading code with your variables more often than you write your variables so I tend to optimize for readability over ease of typing.
- dagss 9y agoIn a setting with much arithmetic "x" is also vastly easier to read. See pretty much any mathematics or physics paper or textbook -- made for reading...
- ethagnawl 9y agoThanks!
- pkaye 9y agoI know a little bit of how it works... Interesting part is in tdraw() which draws one triangle. First find the bounding box of triangle from view space. Iterate over pixels in that box. Map pixel into barycentric coordinates of triangle. (distance from vertexes.) Check zbuffer to see if visible. Take dot product of light direction and triangle normal to get shading. Use barycentric coordinates to interpolate where in texture map to sample shade. Blend shading and lighting. Update zbuffer and pixel color. A model is made of lots of triangles. Each triangle has vertices with additional attributes that map into the texture map.
- ethagnawl 9y agoI'm going to revisit the program with the above in mind. Thanks!