renderObject method

void renderObject(
  1. Object3D object,
  2. dynamic scene,
  3. Camera camera,
  4. BufferGeometry geometry,
  5. Material material,
  6. Map<String, dynamic>? group,
)

Implementation

void renderObject(
    Object3D object, scene, Camera camera, BufferGeometry geometry, Material material, Map<String, dynamic>? group) {
  // print(" render renderObject  type: ${object.type} material: ${material} name: ${object.name}  geometry: ${geometry}");
  // print("1 render renderObject type: ${object.type} name: ${object.name}  ${DateTime.now().millisecondsSinceEpoch}");

  if (object.onBeforeRender != null) {
    object.onBeforeRender!(
        renderer: this,
        mesh: object,
        scene: scene,
        camera: camera,
        geometry: geometry,
        material: material,
        group: group);
  }

  object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);
  object.normalMatrix.getNormalMatrix(object.modelViewMatrix);

  if (material.onBeforeRender != null) {
    material.onBeforeRender!(this, scene, camera, geometry, object, group);
  }

  if (material.transparent == true && material.side == DoubleSide) {
    material.side = BackSide;
    material.needsUpdate = true;
    renderBufferDirect(camera, scene, geometry, material, object, group);

    material.side = FrontSide;
    material.needsUpdate = true;
    renderBufferDirect(camera, scene, geometry, material, object, group);

    material.side = DoubleSide;
  } else {
    renderBufferDirect(camera, scene, geometry, material, object, group);
  }

  object.onAfterRender(
      renderer: this, scene: scene, camera: camera, geometry: geometry, material: material, group: group);

  // print("2 render renderObject type: ${object.type} name: ${object.name} ${DateTime.now().millisecondsSinceEpoch}");
}