hasUniformChanged method

bool hasUniformChanged(
  1. dynamic uniform,
  2. int index,
  3. dynamic indexArray,
  4. dynamic cache,
)

Implementation

bool hasUniformChanged( uniform, int index, indexArray, cache ) {
	final value = uniform['value'];
	final indexString = '${index}_$indexArray';

	if ( cache[ indexString ] == null ) {
		if (value is double || value is int || value is num || value is bool ) {
			cache[ indexString ] = value;
		} else {
			cache[ indexString ] = value.clone();
		}

		return true;
	}
    else {
		final cachedObject = cache[ indexString ];

		// compare current value with cached entry

		if (value is double || value is int || value is num || value is bool ) {
			if ( cachedObject != value ) {
				cache[ indexString ] = value;
				return true;
			}
		}
      else {
			if ( cachedObject.equals( value ) == false ) {
				cachedObject.copy( value );
				return true;
			}
		}
	}

	return false;
}