mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Get rid of MapblockMeshGenerator::cur_node.scale
This commit is contained in:
parent
a14b8d0976
commit
3becbda0aa
2 changed files with 5 additions and 6 deletions
|
@ -1108,7 +1108,7 @@ void MapblockMeshGenerator::drawSignlikeNode()
|
||||||
void MapblockMeshGenerator::drawPlantlikeQuad(const TileSpec &tile,
|
void MapblockMeshGenerator::drawPlantlikeQuad(const TileSpec &tile,
|
||||||
float rotation, float quad_offset, bool offset_top_only)
|
float rotation, float quad_offset, bool offset_top_only)
|
||||||
{
|
{
|
||||||
const f32 scale = cur_node.scale;
|
const f32 scale = cur_plant.scale;
|
||||||
v3f vertices[4] = {
|
v3f vertices[4] = {
|
||||||
v3f(-scale, -BS / 2 + 2.0 * scale * cur_plant.plant_height, 0),
|
v3f(-scale, -BS / 2 + 2.0 * scale * cur_plant.plant_height, 0),
|
||||||
v3f( scale, -BS / 2 + 2.0 * scale * cur_plant.plant_height, 0),
|
v3f( scale, -BS / 2 + 2.0 * scale * cur_plant.plant_height, 0),
|
||||||
|
@ -1164,8 +1164,8 @@ void MapblockMeshGenerator::drawPlantlikeQuad(const TileSpec &tile,
|
||||||
void MapblockMeshGenerator::drawPlantlike(const TileSpec &tile, bool is_rooted)
|
void MapblockMeshGenerator::drawPlantlike(const TileSpec &tile, bool is_rooted)
|
||||||
{
|
{
|
||||||
cur_plant.draw_style = PLANT_STYLE_CROSS;
|
cur_plant.draw_style = PLANT_STYLE_CROSS;
|
||||||
cur_node.scale = BS / 2 * cur_node.f->visual_scale;
|
|
||||||
cur_plant.offset = v3f(0, 0, 0);
|
cur_plant.offset = v3f(0, 0, 0);
|
||||||
|
cur_plant.scale = BS / 2 * cur_node.f->visual_scale;
|
||||||
cur_plant.rotate_degree = 0.0f;
|
cur_plant.rotate_degree = 0.0f;
|
||||||
cur_plant.random_offset_Y = false;
|
cur_plant.random_offset_Y = false;
|
||||||
cur_plant.face_num = 0;
|
cur_plant.face_num = 0;
|
||||||
|
@ -1175,7 +1175,7 @@ void MapblockMeshGenerator::drawPlantlike(const TileSpec &tile, bool is_rooted)
|
||||||
case CPT2_MESHOPTIONS:
|
case CPT2_MESHOPTIONS:
|
||||||
cur_plant.draw_style = PlantlikeStyle(cur_node.n.param2 & MO_MASK_STYLE);
|
cur_plant.draw_style = PlantlikeStyle(cur_node.n.param2 & MO_MASK_STYLE);
|
||||||
if (cur_node.n.param2 & MO_BIT_SCALE_SQRT2)
|
if (cur_node.n.param2 & MO_BIT_SCALE_SQRT2)
|
||||||
cur_node.scale *= 1.41421;
|
cur_plant.scale *= 1.41421;
|
||||||
if (cur_node.n.param2 & MO_BIT_RANDOM_OFFSET) {
|
if (cur_node.n.param2 & MO_BIT_RANDOM_OFFSET) {
|
||||||
PseudoRandom rng(cur_node.p.X << 8 | cur_node.p.Z | cur_node.p.Y << 16);
|
PseudoRandom rng(cur_node.p.X << 8 | cur_node.p.Z | cur_node.p.Y << 16);
|
||||||
cur_plant.offset.X = BS * ((rng.next() % 16 / 16.0) * 0.29 - 0.145);
|
cur_plant.offset.X = BS * ((rng.next() % 16 / 16.0) * 0.29 - 0.145);
|
||||||
|
@ -1274,7 +1274,7 @@ void MapblockMeshGenerator::drawPlantlikeRootedNode()
|
||||||
void MapblockMeshGenerator::drawFirelikeQuad(const TileSpec &tile, float rotation,
|
void MapblockMeshGenerator::drawFirelikeQuad(const TileSpec &tile, float rotation,
|
||||||
float opening_angle, float offset_h, float offset_v)
|
float opening_angle, float offset_h, float offset_v)
|
||||||
{
|
{
|
||||||
const f32 scale = cur_node.scale;
|
const f32 scale = BS / 2 * cur_node.f->visual_scale;
|
||||||
v3f vertices[4] = {
|
v3f vertices[4] = {
|
||||||
v3f(-scale, -BS / 2 + scale * 2, 0),
|
v3f(-scale, -BS / 2 + scale * 2, 0),
|
||||||
v3f( scale, -BS / 2 + scale * 2, 0),
|
v3f( scale, -BS / 2 + scale * 2, 0),
|
||||||
|
@ -1295,7 +1295,6 @@ void MapblockMeshGenerator::drawFirelikeNode()
|
||||||
{
|
{
|
||||||
TileSpec tile;
|
TileSpec tile;
|
||||||
useTile(&tile);
|
useTile(&tile);
|
||||||
cur_node.scale = BS / 2 * cur_node.f->visual_scale;
|
|
||||||
|
|
||||||
// Check for adjacent nodes
|
// Check for adjacent nodes
|
||||||
bool neighbors = false;
|
bool neighbors = false;
|
||||||
|
|
|
@ -66,7 +66,6 @@ private:
|
||||||
LightPair light;
|
LightPair light;
|
||||||
LightFrame frame;
|
LightFrame frame;
|
||||||
video::SColor color;
|
video::SColor color;
|
||||||
f32 scale;
|
|
||||||
} cur_node;
|
} cur_node;
|
||||||
|
|
||||||
// lighting
|
// lighting
|
||||||
|
@ -137,6 +136,7 @@ private:
|
||||||
struct PlantlikeData {
|
struct PlantlikeData {
|
||||||
PlantlikeStyle draw_style;
|
PlantlikeStyle draw_style;
|
||||||
v3f offset;
|
v3f offset;
|
||||||
|
float scale;
|
||||||
float rotate_degree;
|
float rotate_degree;
|
||||||
bool random_offset_Y;
|
bool random_offset_Y;
|
||||||
int face_num;
|
int face_num;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue