atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
ogl_shading.h
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2026 by CNRS and University of Strasbourg */
15
22
23/*
24* This header file: 'ogl_shading.h'
25*
26* Contains:
27
28 - Variable declarations related to GLSL programs
29 - Data structure declarations related to GLSL programs
30
31*/
32
33#ifndef OGL_SHADING_H_
34#define OGL_SHADING_H_
35
48
49#define POLY_BUFF_SIZE 10 // p(x,y,z), n(x,y,z), color (r,g,b,a)
50#define LINE_BUFF_SIZE 7 // p(x,y,z), color (r,g,b,a)
51#define CYLI_BUFF_SIZE 13 // p(x,y,z), length, rad, quat(w,x,y,z), color (r,g,b,a)
52#define CAPS_BUFF_SIZE 12 // p(x,y,z), rad, quat(w,x,y,z), color (r,g,b,a)
53#define ATOM_BUFF_SIZE 8 // p(x,y,z), rad, color (r,g,b,a)
54#define CHAR_BUFF_SIZE 4 // p(x,y), t(x,y)
55
56// Points
57extern const GLchar * point_vertex;
58extern const GLchar * point_color;
59
60// Basic lines
61extern const GLchar * line_vertex;
62extern const GLchar * line_color;
63extern const GLchar * line_stipple;
64extern const GLchar * line_stipple_color;
65extern const GLchar * angle_vertex;
66extern const GLchar * angle_stipple;
67extern const GLchar * angle_color;
68
69extern const GLchar * angstrom_vertex;
70extern const GLchar * degree_vertex;
71
72// Triangles: Multiple lights + Materials + Transparency shaders
73extern const GLchar * full_vertex;
74extern const GLchar * full_color;
75extern const GLchar * full_color_ray;
76
77// Sphere
78extern const GLchar * sphere_vertex;
79extern const GLchar * sphere_vertex_ray;
80// Cylinder and caps
81extern const GLchar * cylinder_vertex;
82extern const GLchar * cylinder_vertex_ray;
83extern const GLchar * cone_vertex;
84extern const GLchar * cone_vertex_ray;
85extern const GLchar * cap_vertex;
86extern const GLchar * cap_vertex_ray;
87
88extern const GLchar * string_vertex;
89extern const GLchar * string_color;
90extern const GLchar * string_color_2d;
91
92extern const GLchar * background_vertex;
93extern const GLchar * background_linear;
94extern const GLchar * background_circular;
95
97typedef struct object_3d object_3d;
115
119{
120 int id;
121 int object;
125 GLenum vert_type;
126 int draw_type;
127 gboolean draw_instanced;
128 GLuint vao;
129 GLuint * vbo;
130 GLuint * array_pointer;
131 GLuint * uniform_loc;
132 GLuint * light_uniform;
136};
137
138extern void allocate_instances (object_3d * object);
139#endif
const GLchar * full_color
const GLchar * string_color_2d
const GLchar * string_vertex
const GLchar * line_stipple_color
const GLchar * cap_vertex_ray
const GLchar * angle_stipple
const GLchar * angle_vertex
const GLchar * background_circular
const GLchar * background_vertex
const GLchar * cylinder_vertex
const GLchar * full_color_ray
const GLchar * string_color
const GLchar * cylinder_vertex_ray
const GLchar * full_vertex
const GLchar * line_color
Definition ogl_shaders.c:93
const GLchar * line_stipple
const GLchar * cap_vertex
const GLchar * background_linear
const GLchar * angle_color
const GLchar * cone_vertex_ray
const GLchar * line_vertex
Definition ogl_shaders.c:80
const GLchar * sphere_vertex
const GLchar * point_vertex
Definition ogl_shaders.c:50
const GLchar * cone_vertex
const GLchar * degree_vertex
const GLchar * point_color
Definition ogl_shaders.c:66
const GLchar * sphere_vertex_ray
const GLchar * angstrom_vertex
void allocate_instances(object_3d *object)
allocate the instances buffer of a 3D object
glsl_styles
Definition ogl_shading.h:37
@ GLSL_LIGHT
Definition ogl_shading.h:45
@ GLSL_CAPS
Definition ogl_shading.h:42
@ GLSL_POINTS
Definition ogl_shading.h:38
@ GLSL_STRING
Definition ogl_shading.h:44
@ GLSL_LINES
Definition ogl_shading.h:40
@ GLSL_POLYEDRA
Definition ogl_shading.h:43
@ GLSL_SPHERES
Definition ogl_shading.h:39
@ GLSL_BACK
Definition ogl_shading.h:46
@ GLSL_CYLINDERS
Definition ogl_shading.h:41
GLuint vertex_shader
GLuint geometry_shader
GLuint * light_uniform
GLenum vert_type
GLuint * array_pointer
GLuint * vbo
object_3d * obj
GLuint fragment_shader
GLuint * uniform_loc
gboolean draw_instanced
ColRGBA * col
GLuint texture
int ind_buffer_size
int num_instances
int * indices
float * vertices
float shift[4]
int num_vertices
int inst_buffer_size
float * instances
int vert_buffer_size
int num_indices