Add Nodebox type="scaled"

User avatar
spootonium
Member
 
Posts: 94
Joined: Fri May 02, 2014 01:38

Add Nodebox type="scaled"

by spootonium » Sun Jun 22, 2014 04:28

My suggestion is that - like the "leveled" type of nodebox - "scaled" nodeboxes would use param2 to store the "level" of the nodebox, and all other dimensions would be interpreted as fractions (technically multiples) of param2. This introduces a method to parametrically define a series of nodeboxes using only a single node type. Potential applications include - plants, fungi, crystals, bubbles, baloons... anything that grows, shrinks, or varies in size.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

-- Example 1 : a simple, centre-aligned cube
nodebox = {
  type = "scaled",
  scaled = {
    -0.5 , -0.5 , -0.5 , 0.5 , 0.5 , 0.5
  }
}

-- Example 2 : an OCD-style flower node
nodebox = {
  type = "scaled",
  scaled = {
  --{  x1  ,  y1  ,  z1  ,  x2  ,  y2  ,  z2  }
    { -0.1 , -0.5 , -0.1 ,  0.1 , 0.1 ,  0.1 }, -- stem
    { -0.3 ,  0.1 , -0.3 , -0.1 , 0.3 , -0.1 }, -- petals
    { -0.3 ,  0.1 ,  0.1 , -0.1 , 0.3 ,  0.3 },
    {  0.1 ,  0.1 ,  0.1 ,  0.3 , 0.3 ,  0.3 },
    { -0.3 ,  0.1 ,  0.1 ,  0.3 , 0.3 , -0.1 }
  }
}



EDIT: Grammar.
I write code. Sometimes, it even works.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Add Nodebox type="scaled"

by TenPlus1 » Sun Jun 22, 2014 19:35

This would be handy indeed for the nodes you just mentioned, I would enjoy using this if it came into being...
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Add Nodebox type="scaled"

by rubenwardy » Sun Jun 22, 2014 21:01

This would be handle if it was intropolated- you could make the flower grow smoothly.

Otherwise you could just do it yourself with multiple nodes already.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Add Nodebox type="scaled"

by philipbenr » Mon Jun 23, 2014 16:37

That is actually a pretty good idea. Very handy indeed.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 8 guests

cron