atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
d_bonds.c File Reference

Functions to prepare the OpenGL rendering of bond(s) and clone bond(s). More...

#include "global.h"
#include "glview.h"
#include "dlp_field.h"
Include dependency graph for d_bonds.c:

Go to the source code of this file.

Functions

object_3ddraw_billboard_quad (void)
 create a camera-aligned billboard quad proxy for perfect impostors.
float get_sphere_radius (int style, int sp, int ac, int sel)
 get an atom sphere radius
ColRGBA get_atom_color (int i, int j, double al, int picked, gboolean to_picked)
 get atom (or clone) color
int cylinder_vertices (int qual)
 return the number of OpenGL vertices to render a cylinder
int cylinder_indices (int qual)
 return the number of OpenGL indices to render a cylinder
object_3ddraw_cylinder (int quality, float ra, float rb)
 OpenGL 3D cylinder object rendering.
int cap_vertices (int qual)
 return the number of OpenGL vertices to render a cylinder cap
int cap_indices (int qual)
 return the number of OpenGL indices to render a cylinder cap
object_3ddraw_cylinder_cap (int quality, float rad, gboolean picked)
 OpenGL 3D cylinder cap object rendering.
vec4_t rotate_bond (vec3_t a, vec3_t b)
 rotate a bond based on the proper orientation
float get_bond_radius (int sty, int ac, int at, int bt, int sel)
 get bond (clone bond) radius
void setup_line_vertice (float *vertices, vec3_t pos, ColRGBA col, float alpha)
 fill the OpenGL data buffer for a line bond (or clone bond) to render
void setup_cylinder_vertice (float *vertices, vec3_t pos_a, vec3_t pos_b, ColRGBA col, float rad, float alpha, float delta, float r_sph_a, float r_sph_b)
 fill the OpenGL data buffer for a cylinder bond (or clone bond) to render
void setup_cap_vertice (float *vertices, vec3_t pos_a, vec3_t pos_b, ColRGBA col, float rad, float alpha, gboolean sel)
 fill the OpenGL data buffer for a cylinder cap bond (or clone bond) to render
void setup_this_bond (int sty, gboolean to_pick, gboolean picked, int cap, int bi, int pi, atom *at, atom *bt, float al, float *vertices)
 prepare the OpenGL rendering data of a bond / clone bond
void prepare_bond (int sty, gboolean to_pick, gboolean picked, int cap, int bi, int pi, int bid, atom *at, atom *bt, float *vertices)
 prepare a bond OpenGL rendering
int find_bond_vertices (gboolean to_pick, int sty, int sa, int sb, int bi, int cap)
 find bond(s) and clone bond(s) to render
void setup_all_cylinder_vertices (int style, gboolean to_pick, int cap, int bi, float *vertices)
 prepare cylinder bond(s) and clone bond(s) to render
void setup_line_vertices (int style, int cap, int bi, int sa, int sb, float *vertices)
 prepare line bond(s) and clone bond(s) to render
int create_bond_lists (gboolean to_pick)
 prepare bond(s) and clone bond(s) OpenGL rendering

Variables

vec3_t model_position
int nbs
int vs_bid

Detailed Description

Functions to prepare the OpenGL rendering of bond(s) and clone bond(s).

Author
Sébastien Le Roux sebas.nosp@m.tien.nosp@m..lero.nosp@m.ux@i.nosp@m.pcms..nosp@m.unis.nosp@m.tra.f.nosp@m.r

Definition in file d_bonds.c.

Function Documentation

◆ cap_indices()

int cap_indices ( int qual)

return the number of OpenGL indices to render a cylinder cap

Parameters
qualOpenGL quality

Definition at line 159 of file d_bonds.c.

◆ cap_vertices()

int cap_vertices ( int qual)

return the number of OpenGL vertices to render a cylinder cap

Parameters
qualOpenGL quality

Definition at line 147 of file d_bonds.c.

◆ create_bond_lists()

int create_bond_lists ( gboolean to_pick)

prepare bond(s) and clone bond(s) OpenGL rendering

Parameters
to_pickto pick (1) or to draw (0)

Definition at line 685 of file d_bonds.c.

◆ cylinder_indices()

int cylinder_indices ( int qual)

return the number of OpenGL indices to render a cylinder

Parameters
qualOpenGL quality

Definition at line 88 of file d_bonds.c.

◆ cylinder_vertices()

int cylinder_vertices ( int qual)

return the number of OpenGL vertices to render a cylinder

Parameters
qualOpenGL quality

Definition at line 76 of file d_bonds.c.

◆ draw_billboard_quad()

object_3d * draw_billboard_quad ( )
extern

create a camera-aligned billboard quad proxy for perfect impostors.

The quad has 4 vertices at unit corners (±1, ±1, 0). Each vertex shader for perfect impostors uses the sign of vert.x / vert.y to select the corresponding edge of the tight axis-aligned bounding box in view space.

Draw primitive: GL_TRIANGLE_STRIP with indices [0,1,2,3]. tri 0 → vertices 0,1,2 tri 1 → vertices 1,2,3

Definition at line 273 of file d_atoms.c.

◆ draw_cylinder()

object_3d * draw_cylinder ( int quality,
float ra,
float rb )

OpenGL 3D cylinder object rendering.

Parameters
qualityOpenGL quality
racylinder radius at 1st side point
rbcylinder radius at 2nd side point

Definition at line 102 of file d_bonds.c.

◆ draw_cylinder_cap()

object_3d * draw_cylinder_cap ( int quality,
float rad,
gboolean picked )

OpenGL 3D cylinder cap object rendering.

Parameters
qualityOpenGL quality
radcylinder radius
pickedis the bond selected (1) or not (0)

Definition at line 173 of file d_bonds.c.

◆ find_bond_vertices()

int find_bond_vertices ( gboolean to_pick,
int sty,
int sa,
int sb,
int bi,
int cap )

find bond(s) and clone bond(s) to render

Parameters
to_pickto pick (1) or to draw (0)
styrendering style
sa1st chemical species
sb2nd chemical species
bibond (0) or clone bond (1)
capdraw cylinder cap (1/0)

Definition at line 514 of file d_bonds.c.

◆ get_atom_color()

ColRGBA get_atom_color ( int i,
int j,
double al,
int picked,
gboolean to_pick )
extern

get atom (or clone) color

Parameters
ichemical species
jthe atom id
alopacity (atom: 1.0, clone: 0.5)
pickedis the atom (clone) selected (1) or not (0)
to_pickto pick (1) or to draw (0)

Definition at line 75 of file d_atoms.c.

◆ get_bond_radius()

float get_bond_radius ( int sty,
int ac,
int at,
int bt,
int sel )

get bond (clone bond) radius

Parameters
stythe rendering style
acatom (0) or clone (1)
at1st chemical species
bt2nd chemical species
selis the bond selected (1) or not (0)

Definition at line 243 of file d_bonds.c.

◆ get_sphere_radius()

float get_sphere_radius ( int style,
int sp,
int ac,
int sel )
extern

get an atom sphere radius

Parameters
stylerendering style
spchemical species
acatom (0) or clone (1)
selis the atom selected (1) or not (0)

Definition at line 305 of file d_atoms.c.

◆ prepare_bond()

void prepare_bond ( int sty,
gboolean to_pick,
gboolean picked,
int cap,
int bi,
int pi,
int bid,
atom * at,
atom * bt,
float * vertices )

prepare a bond OpenGL rendering

Parameters
styrendering style
to_pickto pick (1) or to draw (0)
pickedis the atom selected (1) or not (0)
capdraw cylinder cap
biatom (0) or clone (1) visible
piatom (0) or clone (1) picked
bidbond id
at1st atom
bt2nd atom
verticesthe OpenGL buffer data to fill

Definition at line 457 of file d_bonds.c.

◆ rotate_bond()

vec4_t rotate_bond ( vec3_t a,
vec3_t b )

rotate a bond based on the proper orientation

Parameters
a1st atom position
b2nd atom position

Definition at line 220 of file d_bonds.c.

◆ setup_all_cylinder_vertices()

void setup_all_cylinder_vertices ( int style,
gboolean to_pick,
int cap,
int bi,
float * vertices )

prepare cylinder bond(s) and clone bond(s) to render

Parameters
stylerendering style
to_pickto pick (1) or to draw (0)
capdraw cylinder cap (1/0)
bibond (0) or clone bond (1)
verticesthe OpenGL data buffer to fill

Definition at line 580 of file d_bonds.c.

◆ setup_cap_vertice()

void setup_cap_vertice ( float * vertices,
vec3_t pos_a,
vec3_t pos_b,
ColRGBA col,
float rad,
float alpha,
gboolean sel )

fill the OpenGL data buffer for a cylinder cap bond (or clone bond) to render

Parameters
verticesthe OpenGL buffer to fill
pos_ainitial atom position vector
pos_bcap center position vector
colthe color
radthe radius
alphathe opacity (atom: 1.0, clone: 0.5)
selselected half bond (1/0)

Definition at line 336 of file d_bonds.c.

◆ setup_cylinder_vertice()

void setup_cylinder_vertice ( float * vertices,
vec3_t pos_a,
vec3_t pos_b,
ColRGBA col,
float rad,
float alpha,
float delta,
float r_sph_a,
float r_sph_b )

fill the OpenGL data buffer for a cylinder bond (or clone bond) to render

Parameters
verticesthe OpenGL buffer to fill
pos_a1st atom position
pos_b2nd atom position
colthe color
radthe radius
alphathe opacity (atom: 1.0, clone: 0.5)
deltalength correction if atom(s) are shown
r_sph_asphere radius at the atom side (for in-sphere clipping in the frag shader)
r_sph_bsphere radius at the midpoint side (0.0 for a bond half, > 0 for axis cylinders)

Definition at line 297 of file d_bonds.c.

◆ setup_line_vertice()

void setup_line_vertice ( float * vertices,
vec3_t pos,
ColRGBA col,
float alpha )

fill the OpenGL data buffer for a line bond (or clone bond) to render

Parameters
verticesthe OpenGL buffer to fill
posthe position vector
colthe color
alphathe opacity (atom: 1.0, clone: 0.5)

Definition at line 269 of file d_bonds.c.

◆ setup_line_vertices()

void setup_line_vertices ( int style,
int cap,
int bi,
int sa,
int sb,
float * vertices )

prepare line bond(s) and clone bond(s) to render

Parameters
stylerendering style
capdraw cylinder cap (1/0)
bibond (0) or clone bond (1)
sa1st chemical species
sb2nd chemical species
verticesthe OpenGL buffer to fill

Definition at line 639 of file d_bonds.c.

◆ setup_this_bond()

void setup_this_bond ( int sty,
gboolean to_pick,
gboolean picked,
int cap,
int bi,
int pi,
atom * at,
atom * bt,
float al,
float * vertices )

prepare the OpenGL rendering data of a bond / clone bond

Parameters
styrendering style
to_pickto pick (1) or to draw (0)
pickedis the bond selected (1) or not (0)
capdraw cylinder cap (1/0)
biatom (0) or clone (1) visible
piatom (0) or clone (1) picked
at1st atom
bt2nd atom
althe opacity (bond: 1.0, clone bond: 0.5)
verticesthe OpenGL buffer data to fill

Definition at line 374 of file d_bonds.c.

Variable Documentation

◆ model_position

vec3_t model_position
extern

◆ nbs

int nbs
extern

Definition at line 165 of file d_atoms.c.

◆ vs_bid

int vs_bid

Definition at line 356 of file d_bonds.c.