WaterOptions.fromMap constructor

WaterOptions.fromMap(
  1. Map<String, dynamic> options
)

Implementation

WaterOptions.fromMap(Map<String,dynamic> options){
  color = options['color'] ?? 0xFFFFFF;
		textureWidth = options['textureWidth'] ?? 512;
		textureHeight = options['textureHeight'] ?? 512;
		clipBias = options['clipBias'] ?? 0.0;
		flowDirection = options['flowDirection'] ?? Vector2( 1, 0 );
		flowSpeed = options['flowSpeed'] ?? 0.03;
		reflectivity = options['reflectivity'] ?? 0.02;
		scale = options['scale'] ?? 1;
		shader = options['shader'] ?? Water.waterShader;

		final textureLoader = TextureLoader();

		flowMap = options['flowMap'];
  if(options['normalMap0'] == null){
    textureLoader.fromAsset( 'assets/Water_1_M_Normal.jpg',package: 'three_js_objects').then((m){
      normalMap0 = m!;
    });
  }
  else{
    normalMap0 = options['normalMap0'];
  }

  if(options['normalMap1'] == null){
    textureLoader.fromAsset( 'assets/Water_2_M_Normal.jpg',package: 'three_js_objects').then((m){
      normalMap1 = m!;
    });
  }
  else{
    normalMap1 = options['normalMap1'];
  }
}