Class TPhongShading

Unit

Declaration

type TPhongShading = class(TCustomPhongShading)

Description

Renders shape and height maps using Phong shading.

Phong shading consist in adding an ambiant light, a diffuse light (angle between light and object), and a specular light (angle between light, object and observer, i.e. reflected light).

Height maps are grayscale images or a precise bitmaps filled with MapHeightToBGRA. They are used to determine orientation and position of the surface.

Hierarchy

Overview

Fields

Public AmbientFactor: Single;
Public DiffuseSaturation: Boolean;
Public DiffusionFactor: Single;
Public LightColor: TBGRAPixel;
Public LightDestFactor: Single;
Public LightSourceDistanceFactor: Single;
Public LightSourceDistanceTerm: Single;
Public LightSourceIntensity: Single;
Public NegativeDiffusionFactor: Single;
Public SpecularFactor: Single;
Public SpecularIndex: Single;

Methods

Public constructor Create;
Public procedure Draw(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorMap : TBGRACustomBitmap); override;
Public procedure Draw(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; Color : TBGRAPixel); override;
Public procedure DrawCone(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel); overload;
Public procedure DrawCone(dest: TBGRACustomBitmap; X,Y,Size: Integer; Altitude: Single; Color: TBGRAPixel); overload;
Public procedure DrawHorizontalCylinder(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);
Public procedure DrawRectangle(dest: TBGRACustomBitmap; bounds: TRect; Border: Integer; Altitude: Single; Color: TBGRAPixel; RoundCorners: Boolean; Options: TRectangleMapOptions);
Public procedure DrawScan(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorScan : IBGRAScanner); override;
Public procedure DrawSphere(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);
Public procedure DrawVerticalCone(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);
Public procedure DrawVerticalCylinder(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);
Protected procedure DrawColorNormal(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; Color : TBGRAPixel);
Protected procedure DrawMapNormal(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorMap : TBGRACustomBitmap);
Protected procedure DrawScannerNormal(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorScan : IBGRAScanner);

Description

Fields

Public AmbientFactor: Single;

how concentrated reflected light is (positive value)

Public DiffuseSaturation: Boolean;

how much hidden surface are darkened (0..1)

Public DiffusionFactor: Single;

ambiant lighting whereever the point is (0..1)

Public LightColor: TBGRAPixel;

how much the location of the lightened pixel is taken into account (usually 0 or 1)

Public LightDestFactor: Single;

how much actual distance is taken into account (usually 0 or 1)

Public LightSourceDistanceFactor: Single;

minimum distance always added (positive value)

Public LightSourceDistanceTerm: Single;

global intensity of the light

Public LightSourceIntensity: Single;

This item has no description.

Public NegativeDiffusionFactor: Single;

diffusion, i.e. how much pixels are lightened by light source (0..1)

Public SpecularFactor: Single;

color of the light reflection

Public SpecularIndex: Single;

how much light is reflected (0..1)

Methods

Public constructor Create;

when diffusion saturates, use light color to show it

Public procedure Draw(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorMap : TBGRACustomBitmap); override;

Render with a color map of the same size as the height map. Map altitude indicate the global height of the map.

Public procedure Draw(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; Color : TBGRAPixel); override;

Render the specified map on the destination bitmap with one solid color. Map altitude indicate the global height of the map.

Public procedure DrawCone(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel); overload;

This item has no description.

Public procedure DrawCone(dest: TBGRACustomBitmap; X,Y,Size: Integer; Altitude: Single; Color: TBGRAPixel); overload;

Draw a cone of the specified color

Public procedure DrawHorizontalCylinder(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);

Draw an horizontal cylinder of the specified color

Public procedure DrawRectangle(dest: TBGRACustomBitmap; bounds: TRect; Border: Integer; Altitude: Single; Color: TBGRAPixel; RoundCorners: Boolean; Options: TRectangleMapOptions);

Draw a rectangle of the specified color

Public procedure DrawScan(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorScan : IBGRAScanner); override;

Render with a color scanner. Map altitude indicate the global height of the map.

Public procedure DrawSphere(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);

Draw a hemisphere of the specified color

Public procedure DrawVerticalCone(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);

Draw a vertical cone of the specified color

Public procedure DrawVerticalCylinder(dest: TBGRACustomBitmap; bounds: TRect; Altitude: Single; Color: TBGRAPixel);

Draw a vertical cylinder of the specified color

Protected procedure DrawColorNormal(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; Color : TBGRAPixel);

This item has no description.

Protected procedure DrawMapNormal(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorMap : TBGRACustomBitmap);

This item has no description.

Protected procedure DrawScannerNormal(dest: TBGRACustomBitmap; map: TBGRACustomBitmap; mapAltitude: single; ofsX,ofsY: integer; ColorScan : IBGRAScanner);

This item has no description.