27 #define NTOP 0x00001000
28 #define NBOT 0x00000100
29 #define NLFT 0x00000010
30 #define NRGT 0x00000001
32 #define NALL 0x00001111
34 #define NTL 0x00001010
35 #define NTR 0x00001001
36 #define NBL 0x00000110
37 #define NBR 0x00000101
45 temp[0] = (float)-dz1 * y_res_z2; \
46 temp[1] = (float)dz2 * x_res_z2; \
48 normalizer = sqrt(temp[0] * temp[0] + temp[1] * temp[1] + c_z2_sq); \
51 temp[X] /= normalizer; \
52 temp[Y] /= normalizer; \
53 temp[Z] /= normalizer; \
57 static float x_res_z2, y_res_z2;
58 static float c_z2, c_z2_sq;
60 static unsigned long *norm;
79 #ifdef USE_GL_NORMALIZE
81 c_z2_sq = c_z2 * c_z2;
92 c_z2_sq = c_z2 * c_z2;
151 for (col = 1; col < xcnt; col++) {
160 for (row = 1; row < ycnt; row++) {
162 G_debug(5,
"gs_calc_normals(): row=%d", row);
168 for (col = 1; col < xcnt; col++) {
180 for (col = 1; col < xcnt; col++) {
209 float temp[3], normalizer, dz1, dz2, z0, z1, z2, z3, z4;
214 if (neighbors &
NTOP) {
221 if (neighbors &
NBOT) {
228 if (neighbors &
NLFT) {
235 if (neighbors &
NRGT) {
248 noffset =
DRC2OFF(gs, drow, dcol);
254 z1 = z2 = z3 = z4 = z0;
257 if (neighbors &
NRGT) {
259 if (!(neighbors &
NLFT)) {
264 if (neighbors &
NLFT) {
267 if (!(neighbors &
NRGT)) {
272 if (neighbors &
NTOP) {
275 if (!(neighbors &
NBOT)) {
280 if (neighbors &
NBOT) {
283 if (!(neighbors &
NTOP)) {
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
int G_debug(int, const char *,...) __attribute__((format(printf
int gs_update_curmask(geosurf *)
Update current maps.
void GS_get_scale(float *, float *, float *, int)
Get axis scale.
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
float GS_global_exag(void)
Get global z-exag value.
#define SET_NORM(i)
This macro is only used in the function calc_norm()
int gs_calc_normals(geosurf *gs)
Calculate normals.
int calc_norm(geosurf *gs, int drow, int dcol, unsigned int neighbors)
Calculate normals.
void init_vars(geosurf *gs)
Init variables.
#define GET_MAPATT(buff, offset, att)
#define DRC2OFF(gs, drow, dcol)