texture mapping
texture
texture("pname param")
Calls the OpenGLles glTexParamater function with parameters pname and param:
GL_TEXTURE_MIN_FILTER
GL_NEAREST
GL_LINEAR
GL_NEAREST_MIPMAP_NEAREST
GL_LINEAR_MIPMAP_NEAREST
GL_NEAREST_MIPMAP_LINEAR
GL_LINEAR_MIPMAP_LINEAR
GL_TEXTURE_MAG_FILTER
GL_LINEAR
GL_NEAREST
GL_TEXTURE_WRAP_S
GL_CLAMP
GL_REPEAT
GL_TEXTURE_WRAP_T
GL_TEXTURE_BORDER_COLOR
GL_TEXTURE_PRIORITY
By default the 2D textures are initialized to ("GL_TEXTURE_MIN_FILTER GL_NEAREST").
texture brush
texture brush(id1)
Returns the identifier of the image associated with the
brush id1 of type texture.
texture brush(id1)=id2
Changes this identifier.
Note:
When displayed at the point (x,y) the brush id1 will be filled
with the window (x,y,x+nx-1,y+ny-1) of image id2 (with
(nx,ny = radius brush(id1).
texture directory
texture directory("dir")
Builds texture name=dir/*.ima ans returns the number of such files.
Note:
If dir contains directories dir1, dir2, .. containing files *.ima the names of those files
are put in order in objects texture directories name diri, see
edit texture
Options:
dim(nx,ny): changes size of files *.ima.
memory: files are loaded into memory.
NP(nd): only nd folders are loaded, in memory mode
default is the number of folders and in no memory mode defualt is 3 (others are dynamically read).
read(num): loads files in images [num,num+1,...] (needed).
texture directory NP
Returns the number of directories loaded of texture directory
Options:
disk: returns the number of all directories of texture directory
texture fac
texture fac(f) vol(id)
Returns the number of the texture associated with the facet f of volume id.
texture fac(f) vol(id)=num
Changes this number.
Remarque: texture vol and texture fac vol are incompatible, destroying one another.
texture generate
texture generate vol(id)
Returns the texture generate property of vol id automatically generated by command
image dim texture
texture image
texture image(id)
Returns the number of the texture associated with the image id.
texture image(id)=num
Changes this number.
texture image NP
Returns the number of files *.ima read by texture directory.
texture interpol
texture interpol obj(id)=ni
Builds property texture interpol of object type obj id
(obj can be vol or image):
cpt
ni: number of interpolated images
debug
bit1, inc_bit1, number1, nz1
bit2, inc_bit2, number2, nz2
law
fbit1, fbit2
speed
type1, type2
directory number
nb_limit, limit
If obj=vol allows animated textures on grid from 3D images.
See a simple example in basic1_texture._interpolfunc
If obj=image allows animated images.
texeture interpol bitmap obj(id)
Returns (bit1,bit2)
texture interpol debug(d)obj(id)
sets texture interpol debug obj(id)=d.
if(d==1): debug mode, prints informations.
texture interpol directory obj(id)
Returns directory
texture interpol directory(d)obj(id): changes directory in [1,texture NP[
Allows limit the images to those of this directory.
texture interpol law obj(id)
Returns law
texture interpol law(x1,y1,0, x2,y2,0, ...)obj(id)
Changes law.
texture interpol limit obj(id)
Returns limit.
texture interpol limit obj(id)=d1,d2,...,dn
Restricts directories to be di.
type obj(id)=0 || 1 makes directories periodic or random.
texture interpol name obj(id)
Returns the current name of directory of volume id.
Options:
image(num): returns the name of image number num of directory of volume id.
texture interpol number obj(id)
Returns number1,number2.
texture interpol number(number1,number2)obj(id)
texture obj(id) is number1,number2 in turn.
texture interpol number(number2)obj(id)
Changes only number2 preserving number1 allowing start a second texture layer
(smoothly with option law).
texture interpol secz obj(id)
Returns (nz1,nz2)
texture interpol speed obj(id)
Returns speed of bitmaps.
interpol texture speed vol(id)=s
Changes this speed.
texture interpol type obj(id)
Returns type
texture interpol type(s)obj(t) or
type texture interpol type obj(t) : changes type
type(-2): inchanged, changed by:
texture interpol number(num)obj(id)
type(-1): period
type(0): random
Options:
directory(d): relative to the layer d of
directories
in [1,texture directory NP].
texture interpol var obj(id)
Returns 1 (constant directory), 0 (variable directory)
texture interpol var obj(id)=v
Changes var.
edit texture interpol vol(id)
prints those parameters.
texture validate vol
Texture animation.
Principle
Multi layers texture are defined on a grid id by:
texture vol(id)=n1,n2,... and
transp texture vol(id)=t1,t2,....
An automatic variation of transparencies and validations of volumes
allow animate those textures.
Default property texture validate of volume vol(id):
flag 0
number > 0
image = 0
period = 0
interpol = 0
val = associated 3D image to the texture
bit = 0, inc_bit = 1 (float) bit = 0.0
speed = 1
nz = number of bitmap
inc = image increment
transparency law
type = "period puls rand"
texture(num)directory("dir")vol(id)
The images are in directory dir
Options:
read(num): load files in images (num,num+1,...).
read(0): does not load files.
texture(num)validate exec(e)vol(id)
exec(0): inhibits texture num.
exec(1): activates texture num.
texture(num)validate image(ima)vol(id)
ima is the image associated to the texture of level num.
texture validate interpol(ni)
ni = number of images interpolating two levels of textures.
texture(num)validate law(w)vol(id)
Changes parameter law of property number num.
texture(num)name("n1.ima n2.ima ...")vol(id)
Les images are n1.ima n2.ima ...
Options:
read(num): load files in images (num,num+1,...).
texture validate period(p)vol(id)
period(0): stop animation (default).
period(1): im,im+1,...,im+nb-1,im,im+1,...
period(-1): im,im+1,...,im+nb-1,im,im+nb-2,...,im,im+1,....
texture(num)validate speed(s)vol(id)
Changes parameter speed of property number num.
texture(num)validate type("t")vol(id)
with option interpol:
type("period"): images number = (0,1,...,nb-1,0,1,...)
type("rand"): images number = rand(nb)
texture(num)validate(v)vol(id)
Makes the image associated to layer number num:
validate(ind): image index ind in the list validate name.
validate("nnn.ima"): any image name nnn.ima.
See also
example
Example
Build a grid:
grid(1)dim(800,600);
Build a data base of images (101,102,...) (*.ima in directory dir):
texture directory("dir")read(101);
Make textures 1 and 2 animated:
texture(0)validate(0)image(-1)period(-1)vol(1);
texture(0)validate(1)image(-2)period(-1)speed(.5)vol(1);
Make a law variation:
texture(2)validate law(0,1,0, .5,0,0, 1,1,0)vol(1);
Activate illumination and texturing:
yes illum texture;
Interaction process:
interaction;
texture vol
texture vol(id)
Returns texture associated with the volume id.
Notes:
texture can be defined only on volume having secx and secy (ball, geod, grid, prism, pipe, rev).
For any other volume use texture fac.
texture vol et texture fac vol are incompatible, destroying one another.
texture vol(id)=t
Changes this number.
transp texture vol(id) is built.
Transparency
For multiple textures texture vol(id)=t1,t2,..., define transparency by
transp texture vol(id)=tt1,tt2,...
For 3D images,
bitmap vol(id) is automatically built.
Using:
1) Build an image id
Either:
read image(id)name("nn.ext")dim(nx,ny)
or:
generate(2)image-id)poi(x,y)dim(nx,ny).
nx et ny are to be powers of 2 (2, 4, 8, 16, 32, ...).
2) Build volumes with texture
texture vol(id)=num.
3) Display
Activate yes illum and yes texture.
displ vol.
Notes
1) The textures are only implemented on surfaces isomorphic to the grids (open or closed):
ball
geod
grid
rev
pipe
2) The textures on facets are implementers only on quadrilateral facets.
texture name
texture name
Returns the list of files built by texture directory("dir")
or by:
texture name("n1.ima n2.ima ...")
Builds list ("n1.ima n2.ima ...")
Options:
read(num): loads those files in images number num,num+1,... (num = 1 by default).
texture NP
Returns the number of loaded files of texture directory read NP.
Options:
disk: returns the number of all files of texture name.
TEXTURE
texture
rota
vol
Voir_aussi
texture rota
texture(x,y,z,v) rota
Retourne une turbulence de paramètres: (x,y,z) = point de l´espace
et v contrôle la turbulence
texture vol
vol
poles
turbulance
interpol
bump
procédurale
programmée
texture vol
texture vol num
Retourne les paramètres de texture 3D du volume num
texture vol num=code,datas
Le type de la texture dépend de la valeur de code
Poles de couleurs
code = 1:
datas = D1,D2,...
Di = (r1,r2,r3,r4,r5,v1,v2,v3,v4,v5,b1,b2,b3,b4,b5)
r1,v1,b1 = amplitudes
r2,v2,b2 = fréquences
(r3,r4,r5), (v3,v4,v5) et (b3,b4,b5) = centres
La couleur au point (x,y,z) est calculée par:
r = SIGMA(de 1 à np) (r1 * sin(2*PI*r2*distance((x,y,z),(r3,r4,r5))))
v = SIGMA(de 1 à np) (v1 * sin(2*PI*r2*distance((x,y,z),(v3,v4,v5))))
b = SIGMA(de 1 à np) (b1 * sin(2*PI*r2*distance((x,y,z),(b3,b4,b5))))
Turbulance
code = 2:
Turbulence
datas=r,v,b: entre .000001 et 1
code = 3:
Interpolation de textures
datas = n1,z1,n2,z2
ni = numéro d´une image
zi = profondeur (par rapport à l´eye) de l´image ni
La couleur au point (x,y,z) est calculée par interpolation, sur les z,
des couleurs en (x,y) des images n1 et n2
Bump mapping
code = 4
datas=dx,dy,dz
La normal est bruitée de (dx,dy,dz)
Bump mapping aléatoire
code = 5
datas = dx,dy,dz
La normal est bruitée d´une quantité aléatoire d´amplitude (dx,dy,dz)
Procédurale
En langage anyflo)
texture vol num="name"
Affecte la fonction de texture "name" au volume num. Lors d´un affichage
(si yes texture est actif) la fonction "name" sera exécutée à chaque
affichage de pixel dont la couleur sera prise égale à la valeur retournée
par la fonction col.
Remarque:
Une telle fonction peut utiliser les fonctions suivantes:
poi: Qui retourne les coordonnées du point 3D actuellement affiché
col: Qui retourne la couleur de ce point
normal: Qui retourne la normal em ce point
col(r,v,b): Qui affecte une nouvelle couleur en ce point (définit une
texture3D)
normal(nx,ny,nz): Qui affecte une nouvelle normal en ce point
(définit un BUMP-MAPPING)
Exemple:
name()
{
w=poi;x=w[0];y=w[1];z=w[2]:
r=cos(x/10):v=sin(y/10):b=cos(z/10):
col r,v,b:
}
Programmée
En langage C)
code < 0:
datas = ...
La couleur au point (x,y,z) est calculée par la fonction
texture3d_utilisateur(code, pd, cont, p_col) du fichier utilb.c
code = 20: Texture 3D (animée sur le disk)
datas = x1,y1,z1,x2,y2,z2,i1,i2
La texture suivante doit être un name de fichier image .raw
Exemple:
texture(0)vol(1)=20,-200,-200,-500,200,200,1000,1,1000;
texture(0)vol(1)="A";
Chaque point(xa,ya,za) du volume(1) prend la couleur du pixel(x,y)
de l´image Azzz.raw de dimensions (dimx,dimy).
x varie entre 0 et dimx quand xa varie entre x1 et x2.
y varie entre 0 et dimxy quand ya varie entre y1 et y2.
z varie entre i1 et i2 quand za varie entre z1 et z2.
Remarques:
1) code < 0: Permet de définir plusieurs types de textures
pd est un pointer vers les datas
cont est un pointer de type struct Contour vers le point
cont->xa, cont->ya, cont->za sont les coordonnées absolues
cont->nx, cont->ny et cont->nz est la normal
cont->r, cont->v et cont->b est la couleur
2) Il est nécessaire, pour utiliser cette variante, de modifier le fichier
utilb.c et de relinker anyflo (les fichiers utilb.c, les objets et makefile
se trouvent dans le directory de l´environnement)
Voir aussi:
generate texture vol
no texture
yes texture
See also: