FreeWRL/FreeX3D  3.0.0
Material.c
1 /*
2 
3 
4 Only do material settings that "matter" and bounds check all values.
5 
6 */
7 
8 
9 /****************************************************************************
10  This file is part of the FreeWRL/FreeX3D Distribution.
11 
12  Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
13 
14  FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
15  it under the terms of the GNU Lesser Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  FreeWRL/FreeX3D is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
26 ****************************************************************************/
27 
28 
29 
30 #include <config.h>
31 #include <system.h>
32 #include <display.h>
33 #include <internal.h>
34 #include "Material.h"
35 
36 #include <libFreeWRL.h>
37 
38 /* #include "LinearAlgebra.h" */
39 
40 int verify_rotate(GLfloat *params) {
41  /* angle very close to zero? */
42  if (fabs(params[3]) < 0.001) return FALSE;
43  return TRUE;
44 }
45 
46 int verify_translate(GLfloat *params) {
47  /* no translation? */
48 
49  if ((fabs(params[0]) < 0.001) &&
50  (fabs(params[1]) < 0.001) &&
51  (fabs(params[2]) < 0.001)) return FALSE;
52  return TRUE;
53 }
54 
55 
56 int verify_scale(GLfloat *params) {
57  /* no translation? */
58 
59  if ((fabs(params[0]-1.0) < 0.001) &&
60  (fabs(params[1]-1.0) < 0.001) &&
61  (fabs(params[2]-1.0) < 0.001)) return FALSE;
62 
63  return TRUE;
64 }