Exemplo n.º 1
0
 Vector4 CSGNoiseSource::getValueAndGradient(const Vector3 &position) const
 {
     return Vector4(
         getInternalValue(Vector3(position.x + mGradientOff, position.y, position.z)) - getInternalValue(Vector3(position.x - mGradientOff, position.y, position.z)),
         getInternalValue(Vector3(position.x, position.y + mGradientOff, position.z)) - getInternalValue(Vector3(position.x, position.y - mGradientOff, position.z)),
         getInternalValue(Vector3(position.x, position.y, position.z + mGradientOff)) - getInternalValue(Vector3(position.x, position.y, position.z - mGradientOff)),
         getInternalValue(position));
 }
void DefaultBoundedRangeModel::setRangeProperties(Int32 value, UInt32 extent, Int32 min, Int32 max, bool adjusting)
{
    if(getInternalExtent() != extent ||
       getInternalMaximum() != max ||
       getInternalMinimum() != min ||
       getInternalValue() != value ||
       getInternalValueIsAdjusting() != adjusting)
    {

        setInternalExtent(extent);
        setInternalMaximum(max);
        setInternalMinimum(min);
        setInternalValueIsAdjusting(adjusting);
        if(value + static_cast<Int32>(getInternalExtent()) > getInternalMaximum() && getInternalExtent() < getInternalMaximum() - getInternalMinimum())
        {
            setInternalValue( getInternalMaximum() - getInternalExtent());
        }
        else if(value < getInternalMinimum())
        {
            setInternalValue(getInternalMinimum());
        }
        else
        {
            setInternalValue(value);
        }
    }
}
void DefaultBoundedRangeModel::setMinimum(Int32 newMinimum)
{
    if(getInternalMinimum() != newMinimum)
    {
        setInternalMinimum(newMinimum);
    }
    if(getInternalValue() < getInternalMinimum())
    {
        setInternalValue(getInternalMinimum());
    }
}
void DefaultBoundedRangeModel::setMaximum(Int32 newMaximum)
{
    if(getInternalMaximum() != newMaximum);
    {
        setInternalMaximum(newMaximum);
    }
    if(getInternalValue() + static_cast<Int32>(getInternalExtent()) > getInternalMaximum())
    {
        setInternalValue(getInternalMaximum() - getInternalExtent());
    }
}
void DefaultBoundedRangeModel::setValue(Int32 newValue)
{
    if(getInternalValue() != newValue)
    {
        if(newValue + static_cast<Int32>(getInternalExtent()) > getInternalMaximum())
        {
            setInternalValue(getInternalMaximum() - getInternalExtent());
        }
        else if(newValue < getInternalMinimum())
        {
            setInternalValue(getInternalMinimum());
        }
        else
        {
            setInternalValue(newValue);
        }
    }
}
Int32 DefaultBoundedRangeModel::getValue(void) const
{
    return getInternalValue();
}
Exemplo n.º 7
0
 Real CSGNoiseSource::getValue(const Vector3 &position) const
 {
     return getInternalValue(position);
 }