@ -29,14 +29,14 @@ static const char *NL_DefaultVegetName= "<default>";
CVegetableNode : : CVegetableNode ( void )
CVegetableNode : : CVegetableNode ( void )
{
{
V egetable = NULL ;
_v egetable = NULL ;
V egetableName = NL_DefaultVegetName ;
_v egetableName = NL_DefaultVegetName ;
V isible = true ;
_v isible = true ;
}
}
void CVegetableNode : : initDefaultVegetable ( )
void CVegetableNode : : initDefaultVegetable ( )
{
{
Vegetable = new NL3D : : CVegetable ;
_vegetable = new NL3D : : CVegetable ;
// update vegetableName according to Vegetable
// update vegetableName according to Vegetable
updateVegetableName ( ) ;
updateVegetableName ( ) ;
@ -44,59 +44,59 @@ void CVegetableNode::initDefaultVegetable()
// General/Density.
// General/Density.
// Density.
// Density.
V egetable- > Density . Abs = NL_VEGETABLE_DENSITY_ABS_DEFAULT ;
_v egetable- > Density . Abs = NL_VEGETABLE_DENSITY_ABS_DEFAULT ;
V egetable- > Density . Rand = NL_VEGETABLE_DENSITY_RAND_DEFAULT ;
_v egetable- > Density . Rand = NL_VEGETABLE_DENSITY_RAND_DEFAULT ;
V egetable- > Density . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > Density . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// disable MaxDensity
// disable MaxDensity
V egetable- > MaxDensity = - 1 ;
_v egetable- > MaxDensity = - 1 ;
// Leave ShapeName to ""
// Leave ShapeName to ""
// Default DistType is always 0.
// Default DistType is always 0.
V egetable- > DistType = 0 ;
_v egetable- > DistType = 0 ;
// Apperance
// Apperance
// BendPhase
// BendPhase
V egetable- > BendPhase . Abs = NL_VEGETABLE_BENDPHASE_ABS_DEFAULT ;
_v egetable- > BendPhase . Abs = NL_VEGETABLE_BENDPHASE_ABS_DEFAULT ;
V egetable- > BendPhase . Rand = NL_VEGETABLE_BENDPHASE_RAND_DEFAULT ;
_v egetable- > BendPhase . Rand = NL_VEGETABLE_BENDPHASE_RAND_DEFAULT ;
V egetable- > BendPhase . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > BendPhase . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// BendFactor
// BendFactor
V egetable- > BendFactor . Abs = NL_VEGETABLE_BENDFACTOR_ABS_DEFAULT ;
_v egetable- > BendFactor . Abs = NL_VEGETABLE_BENDFACTOR_ABS_DEFAULT ;
V egetable- > BendFactor . Rand = NL_VEGETABLE_BENDFACTOR_RAND_DEFAULT ;
_v egetable- > BendFactor . Rand = NL_VEGETABLE_BENDFACTOR_RAND_DEFAULT ;
V egetable- > BendFactor . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > BendFactor . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// Color
// Color
V egetable- > Color . NoiseValue . Abs = NL_VEGETABLE_COLOR_ABS_DEFAULT ;
_v egetable- > Color . NoiseValue . Abs = NL_VEGETABLE_COLOR_ABS_DEFAULT ;
V egetable- > Color . NoiseValue . Rand = NL_VEGETABLE_COLOR_RAND_DEFAULT ;
_v egetable- > Color . NoiseValue . Rand = NL_VEGETABLE_COLOR_RAND_DEFAULT ;
V egetable- > Color . NoiseValue . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > Color . NoiseValue . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// Scale
// Scale
// ScaleXY
// ScaleXY
V egetable- > Sxy . Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT ;
_v egetable- > Sxy . Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT ;
V egetable- > Sxy . Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT ;
_v egetable- > Sxy . Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT ;
V egetable- > Sxy . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > Sxy . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// ScaleZ.
// ScaleZ.
V egetable- > Sz . Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT ;
_v egetable- > Sz . Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT ;
V egetable- > Sz . Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT ;
_v egetable- > Sz . Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT ;
V egetable- > Sz . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > Sz . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// Rotate
// Rotate
// RotateX
// RotateX
V egetable- > Rx . Abs = NL_VEGETABLE_ROTATEX_ABS_DEFAULT ;
_v egetable- > Rx . Abs = NL_VEGETABLE_ROTATEX_ABS_DEFAULT ;
V egetable- > Rx . Rand = NL_VEGETABLE_ROTATEX_RAND_DEFAULT ;
_v egetable- > Rx . Rand = NL_VEGETABLE_ROTATEX_RAND_DEFAULT ;
V egetable- > Rx . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > Rx . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// RotateY
// RotateY
V egetable- > Ry . Abs = NL_VEGETABLE_ROTATEY_ABS_DEFAULT ;
_v egetable- > Ry . Abs = NL_VEGETABLE_ROTATEY_ABS_DEFAULT ;
V egetable- > Ry . Rand = NL_VEGETABLE_ROTATEY_RAND_DEFAULT ;
_v egetable- > Ry . Rand = NL_VEGETABLE_ROTATEY_RAND_DEFAULT ;
V egetable- > Ry . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
_v egetable- > Ry . Frequency = NL_VEGETABLE_FREQ_DEFAULT ;
// RotateZ
// RotateZ
V egetable- > Rz . Abs = NL_VEGETABLE_ROTATEZ_ABS_DEFAULT ;
_v egetable- > Rz . Abs = NL_VEGETABLE_ROTATEZ_ABS_DEFAULT ;
V egetable- > Rz . Rand = NL_VEGETABLE_ROTATEZ_RAND_DEFAULT ;
_v egetable- > Rz . Rand = NL_VEGETABLE_ROTATEZ_RAND_DEFAULT ;
V egetable- > Rz . Frequency = NL_VEGETABLE_ROTATEZ_FREQ_DEFAULT ;
_v egetable- > Rz . Frequency = NL_VEGETABLE_ROTATEZ_FREQ_DEFAULT ;
}
}
void CVegetableNode : : initVegetable ( const NL3D : : CVegetable & vegetable )
void CVegetableNode : : initVegetable ( const NL3D : : CVegetable & vegetable )
{
{
V egetable = new NL3D : : CVegetable ( vegetable ) ;
_v egetable = new NL3D : : CVegetable ( vegetable ) ;
// update vegetableName according to Vegetable
// update vegetableName according to Vegetable
updateVegetableName ( ) ;
updateVegetableName ( ) ;
}
}
@ -105,27 +105,27 @@ void CVegetableNode::initVegetable(const NL3D::CVegetable &vegetable)
void CVegetableNode : : updateVegetableName ( )
void CVegetableNode : : updateVegetableName ( )
{
{
// Build the vegetable Name according to the ShapeName
// Build the vegetable Name according to the ShapeName
if ( V egetable- > ShapeName = = " " )
if ( _v egetable- > ShapeName = = " " )
{
{
V egetableName = NL_DefaultVegetName ;
_v egetableName = NL_DefaultVegetName ;
}
}
else
else
{
{
std : : string : : size_type pos = V egetable- > ShapeName . find ( " .veget " ) ;
std : : string : : size_type pos = _v egetable- > ShapeName . find ( " .veget " ) ;
VegetableName= V egetable- > ShapeName . substr ( 0 , pos ) ;
_vegetableName = _v egetable- > ShapeName . substr ( 0 , pos ) ;
// And (to be clearer) append distance of creation.
// And (to be clearer) append distance of creation.
char str [ 256 ] ;
char str [ 256 ] ;
sprintf ( str , " - %dm " , ( V egetable- > DistType + 1 ) * 10 ) ;
sprintf ( str , " - %dm " , ( _v egetable- > DistType + 1 ) * 10 ) ;
V egetableName + = str ;
_v egetableName + = str ;
// NB: if you add info with other parameters, you must use updateCurSelVegetableName() if they change
// NB: if you add info with other parameters, you must use updateCurSelVegetableName() if they change
}
}
}
}
void CVegetableNode : : deleteVegetable ( )
void CVegetableNode : : deleteVegetable ( )
{
{
delete V egetable;
delete _v egetable;
V egetable = NULL ;
_v egetable = NULL ;
V egetableName = NL_DefaultVegetName ;
_v egetableName = NL_DefaultVegetName ;
}
}
} /* namespace NLQT */
} /* namespace NLQT */