79 if (
plot -> axis_color != NULL)
81 return plot -> axis_color[id];
86 col.
red = (
id == 2) ? 1.0: 0.0;
88 col.
blue = (
id == 0) ? 1.0: 0.0;
104 float from_edge = 50.0;
106 GLfloat sx = (GLfloat)
wingl -> pixels[0];
107 GLfloat sy = (GLfloat)
wingl -> pixels[1];
108 mat4_t axis_projection_matrix;
111 mat4_t axis_model_view_matrix;
120 axis_projection_matrix =
wingl -> proj_model_matrix;
124 axis_projection_matrix = m4_ortho (
plot -> gleft,
plot -> gright,
plot -> gbottom,
plot -> gtop, -
plot -> gfar,
plot -> gfar);
148 x =
plot -> axis_pos[0] * sx / 100.0;
149 y =
plot -> axis_pos[1] * sy / 100.0;
153 win_coord = v3_un_project (vec3(
x,
y,
z),
wingl -> view_port, axis_projection_matrix);
158 axis_view_matrix =
wingl -> view_matrix;
162 axis_view_matrix =
wingl -> model_matrix;
164 axis_model_matrix = m4_translation (win_coord);
165 axis_model_view_matrix = m4_mul (axis_model_matrix, axis_view_matrix);
166 return m4_mul (axis_projection_matrix, axis_model_view_matrix);
235 a = vec3(0.0, 0.0, 0.0);
242 sa = (i == 2) ? -1.0 : 1.0;
247 centroid = v3_add (
a, v3_add(
b, v3_add(
c, v3_add(
d, e))));
271 float shift[3]={0.0, 0.0, 0.0};
273 object_3d * axis_a, * axis_b, * axis_c, * axis_d;
281 axis_a = g_malloc0 (
sizeof*axis_a);
283 axis_a -> num_vertices = 3*2;
284 axis_a -> vertices =
allocfloat (axis_a -> vert_buffer_size*axis_a -> num_vertices);
285 axis_b = g_malloc0 (
sizeof*axis_b);
287 axis_b -> num_vertices = 3*6*9;
288 axis_b -> vertices =
allocfloat (axis_b -> vert_buffer_size*axis_b -> num_vertices);
293 axis_a -> num_instances = 3;
297 axis_b -> num_instances = 3;
301 axis_c -> num_instances = 3;
305 axis_d -> num_instances = 1;
311 (
plot -> box_axis[
AXIS] ==
WIREFRAME) ? axis_b -> vertices : axis_b -> instances,
314 if (
plot -> axis_labels)
322 nshaders += (
plot -> labels_render[2]+1) * (
plot -> labels_list[2] -> last ->
id + 1);
void clean_labels(int id)
clean atomic label shaders
ColRGBA color_axis(int id)
get axis color
void setup_arrow(float *vert, vec3_t a, vec3_t b, vec3_t c, vec3_t d, vec3_t e)
setup axis 3D arrow rendering data
mat4_t create_axis_matrices(int type)
create axis OpenGL rendering matrices
void init_axis_param()
initialize axis rendering parameters
object_3d * draw_sphere(int quality)
OpenGL 3D sphere object rendering.
void setup_sphere_vertice(float *vertices, vec3_t pos, ColRGBA col, float rad, float alpha)
fill the OpenGL data buffer for a atom (or clone) to render
int create_axis_lists()
prepare axis OpenGL rendering
void setup_cylinder_vertice(float *vertices, vec3_t pos_a, vec3_t pos_b, ColRGBA col, float rad, float alpha, float delta)
fill the OpenGL data buffer for a cylinder bond (or clone bond) to render
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
object_3d * draw_cylinder_cap(int quality, float rad, gboolean picked)
OpenGL 3D cylinder cap object rendering.
void prepare_axis_data(float *vert_a, float *vert_b, float *vert_c)
prepare axis OpenGL rendering data buffer
object_3d * draw_cylinder(int quality, float ra, float rb)
OpenGL 3D cylinder object rendering.
void setup_cap_vertice(float *vertices, vec3_t pos_a, vec3_t pos_b, ColRGBA col, float rad, float alpha)
fill the OpenGL data buffer for a cylinder cap bond (or clone bond) to render
void setup_triangles(float *vertices, vec3_t sa, vec3_t sb, vec3_t sc)
setup triangle veertices
float * allocfloat(int val)
allocate a float * pointer
Global variable declarations Global convenience function declarations Global data structure defin...
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void cleaning_shaders(glwin *view, int shader)
re-initialize an OpenGL shader
glsl_program * init_shader_program(int object, int object_id, const GLchar *vertex, const GLchar *geometry, const GLchar *fragment, GLenum type_of_vertices, int narray, int nunif, gboolean lightning, object_3d *obj)
create an OpenGL shader program
const GLchar * full_color
const GLchar * cylinder_vertex
const GLchar * full_vertex
const GLchar * line_color
const GLchar * cap_vertex
const GLchar * line_vertex
const GLchar * sphere_vertex
const GLchar * cone_vertex
void prepare_string(char *text, int id, ColRGBA col, vec3_t pos, float lshift[3], atom *at, atom *bt, atom *ct)
prepare a screen string to be rendered
void render_all_strings(int glsl, int id)
render all string to be rendered for a label list