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;
105 float from_edge = 50.0;
107 GLfloat sx = (GLfloat)
wingl -> pixels[0];
108 GLfloat sy = (GLfloat)
wingl -> pixels[1];
109 mat4_t axis_projection_matrix;
112 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;
152 win_coord = v3_un_project (vec3(
x,
y,
z),
wingl -> view_port, axis_projection_matrix);
157 axis_view_matrix =
wingl -> view_matrix;
161 axis_view_matrix =
wingl -> model_matrix;
163 axis_model_matrix = m4_translation (win_coord);
164 axis_model_view_matrix = m4_mul (axis_model_matrix, axis_view_matrix);
165 return m4_mul (axis_projection_matrix, axis_model_view_matrix);
234 a = vec3(0.0, 0.0, 0.0);
241 sa = (i == 2) ? -1.0 : 1.0;
246 centroid = v3_add (
a, v3_add(
b, v3_add(
c, v3_add(
d, e))));
270 float shift[3]={0.0, 0.0, 0.0};
272 object_3d * axis_a, * axis_b, * axis_c, * axis_d;
280 axis_a = g_malloc0 (
sizeof*axis_a);
282 axis_a -> num_vertices = 3*2;
283 axis_a -> vertices =
allocfloat (axis_a -> vert_buffer_size*axis_a -> num_vertices);
284 axis_b = g_malloc0 (
sizeof*axis_b);
286 axis_b -> num_vertices = 3*6*9;
287 axis_b -> vertices =
allocfloat (axis_b -> vert_buffer_size*axis_b -> num_vertices);
292 axis_a -> num_instances = 3;
296 axis_b -> num_instances = 3;
300 axis_c -> num_instances = 3;
304 axis_d -> num_instances = 1;
310 (
plot -> box_axis[
AXIS] ==
WIREFRAME) ? axis_b -> vertices : axis_b -> instances,
313 if (
plot -> axis_labels)
321 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