~ubuntu-branches/ubuntu/quantal/aqsis/quantal

« back to all changes in this revision

Viewing changes to tools/dbo/plane/dbo_plane.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-08-06 04:53:26 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806045326-z6xeaaao62idxcc6
Tags: 1.6.0-0ubuntu1
* New upstream release
* debian/control:
  - changed name of lib package to libaqsis1 instead of aqsis-libsc2a
  - changed name of dev package to libaqsis-dev instead of aqsis-libs-dev
  - Added aqsis-data package
  - Revised summary text according to that specified by the RISpec (Pixar)
* Moved examples installation from aqsis.install to aqsis-data.install
* debian/rules: 
  - added content to binary-indep target
* debian/rules: added explicit name of mime file to force dh_installmime
  to generate postinst and prerm scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * dbo_plane.c - sample Dynamic Blob Op
 
3
 *
 
4
 * Description:  a unit square in the xy-plane, at z=0,
 
5
 *   centered at the origin
 
6
 *   The blob expects a single float argument that gives
 
7
 *   the height at which the field goes to 0
 
8
 * 
 
9
 * (c) 2003 SiTex Graphics, Inc.
 
10
 *
 
11
 */
 
12
 
 
13
#include "implicit.h"
 
14
 
 
15
EXPORT void ImplicitBound(State *s, float *bd,
 
16
                                          int niarg, int *iarg,
 
17
                                          int nfarg, float *farg,
 
18
                                          int nsarg, char **sarg)
 
19
{
 
20
  bd[0]=-0.5;
 
21
  bd[1]=0.5;
 
22
  bd[2]=-0.5; bd[3]=0.5;
 
23
  bd[4]=-farg[0]; bd[5]=farg[0];
 
24
}
 
25
 
 
26
float level(float v, float h)
 
27
{
 
28
  float r=(v/h+1.0f)*0.5f;
 
29
  if (r<0.0) r=0.0f;
 
30
  if (r>1.0) r=1.0f;
 
31
  return r;
 
32
}
 
33
 
 
34
EXPORT void ImplicitValue(State *s, float *result, float *p,
 
35
                                          int niarg, int *iarg,
 
36
                                          int nfarg, float *farg,
 
37
                                          int nsarg, char **sarg)
 
38
{
 
39
  if ((p[0]<-0.5)||(p[0]>0.5)||(p[1]<-0.5)||(p[1]>0.5)) {
 
40
    result[0]=1.0;
 
41
  } else {
 
42
    result[0] = level(p[2],farg[0]);
 
43
  }
 
44
}
 
45
 
 
46
 
 
47
EXPORT void ImplicitRange(State *s, float *rng,
 
48
                                          float *bd,
 
49
                                          int niarg, int *iarg,
 
50
                                          int nfarg, float *farg,
 
51
                                          int nsarg, char **sarg)
 
52
{
 
53
  if ((bd[0]>0.5)||(bd[1]<-0.5)||(bd[2]>0.5)||(bd[3]<-0.5)||(bd[4]>farg[0])) {
 
54
     rng[0]=1.0; rng[1]=1.0;
 
55
  } else {
 
56
    rng[0]=level(bd[4],farg[0]); rng[1]=level(bd[5],farg[0]);
 
57
  }
 
58
}
 
59
 
 
60
EXPORT void ImplicitFree(State *s)
 
61
{
 
62
}
 
63
 
 
64