manpagez: man pages & more
info mathgl_en
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.2 Lighting

There are several functions for setup lighting. The general function is Light(bool) which switch on/off the lighting for overall plot. It influence only for graphics which created after light call (with one exception, OpenGL). Generally MathGL support up to 10 independent light sources. But in OpenGL mode only 8 of light sources is used due to OpenGL limitations. The position, color, brightness of each light source can be set separately. By default only one light source is active. It is source number 0 with white color, located at top of the plot.

MGL command: light [val=on]
Method on mglGraph: bool Light (bool enable)
C function: void mgl_set_light (HMGL gr, int enable)

Sets the using of light on/off for overall plot. Function returns previous value of lighting. Default value is lightning off.

MGL command: light num val
Method on mglGraph: void Light (int n, bool enable)
C function: void mgl_set_light_n (HMGL gr, int n, int enable)

Switch on/off n-th light source separately.

MGL command: light num xdir ydir zdir ['col'='w' br=0.5]
MGL command: light num xdir ydir zdir xpos ypos zpos ['col'='w' br=0.5]
Method on mglGraph: void AddLight (int n, mglPoint d, char c='w', float bright=0.5, float ap=0)
Method on mglGraph: void AddLight (int n, mglPoint r, mglPoint d, char c='w', float bright=0.5, float ap=0)
C function: void mgl_add_light (HMGL gr, int n, float dx, float dy, float dz)
C function: void mgl_add_light_ext (HMGL gr, int n, float dx, float dy, float dz, char c, float bright, float ap)
C function: void mgl_add_light_loc (HMGL gr, int n, float rx, float ry, float rz, float dx, float dy, float dz, char c, float bright, float ap)

The function adds a light source with identification n in direction d with color c and with brightness bright (which must be in range [0,1]). If position r is specified and isn’t NAN then light source is supposed to be local otherwise light source is supposed to be placed at infinity.

Метод класса mglGraph: void SetDifLight (bool enable)
Функция С: void mgl_set_light_dif (HMGL gr, int enable)

Set on/off to use diffusive light (only for local light sources).

MGL command: ambient val
Метод класса mglGraph: void SetAmbient (float bright=0.5)
Функция С: void mgl_set_ambbr (HMGL gr, float bright)

Sets the brightness of ambient light. The value should be in range [0,1].


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 13, 2012 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.