3#include <cgv/type/info/type_id.h>
4#include <cgv/type/info/type_access.h>
5#include "packing_info.h"
67 void extract_components();
113 bool set_component_format(
const std::string& description);
115 void set_components(
const std::string& _components);
117 static const std::string& get_last_error();
122 unsigned align = 1,
unsigned d0 = 0,
unsigned d1 = 0,
unsigned d2 = 0,
unsigned d3 = 0);
125 unsigned align = 1,
unsigned d0 = 0,
unsigned d1 = 0,
unsigned d2 = 0,
unsigned d3 = 0);
131 friend FRIEND_MEMBER_API std::ostream& operator << (std::ostream& os,
const component_format& cf);
133 template <
typename T>
134 T
get(
int ci,
const void* ptr)
const {
137 int i = packing_info::get_signed(ci, ptr);
141 unsigned int i = packing_info::get_unsigned(ci, ptr);
146 return cgv::type::info::type_access<T>::get(
static_cast<const unsigned char*
>(ptr)+ci*align(get_type_size(get_component_type()),get_component_alignment()), get_component_type());
149 template <
typename T>
150 bool set(
int ci,
void* ptr,
const T& v)
const {
173 unsigned int get_nr_components()
const;
175 unsigned int get_component_index(
const std::string& name)
const;
177 std::string get_component_name(
unsigned int i)
const;
181 void set_component_names(
const std::string& _component_name_list);
189 unsigned int get_entry_size()
const;
198extern CGV_API std::ostream&
operator << (std::ostream& os,
const component_format& cf);
202 const component_format& fmt1,
203 const component_format& fmt2);
208 const component_format& fmt,
209 const char** format_descriptions,
210 const component_format* fmt0 = 0,
211 bool (*fmt1_better_match)(
212 const component_format& fmt,
213 const component_format& fmt1,
219#include <cgv/config/lib_end.h>
the packing_info class stores information about packed integers structures.
ComponentFormat
define standard formats, which should be used to avoid wrong assignment of component names
@ CF_IA
color format with luminance and alpha components: L and A
@ CF_LAST
texture coordinats format with components ts, tt, tr and tq
@ CF_B
green channel of color format
@ CF_P2D
stencil component
@ CF_T3D
texture coordinats format with components ts and tt
@ CF_BGR
color format with components R, G, B and A
@ CF_RGBA
color format with components R, G and B
@ CF_R
undefinded format with no component
@ CF_I
color format with luminance component L
@ CF_A
blue channel of color format
@ CF_N3D
normal format with components nx and ny
@ CF_RGB
color format with two components R and G
@ CF_T2D
normal format with components nx, ny and nz
@ CF_BGRA
color format with components B, G and R
@ CF_LA
color format with intensity component I
@ CF_RG
color format with intensity and alpha components: I and A
@ CF_T4D
texture coordinats format with components ts, tt and tr
@ CF_G
red channel of color format
@ CF_D
color format with components B, G, R and A
@ CF_N2D
point format with components px, py, pz and pw
@ CF_P4D
point format with components px, py and pz
@ CF_P3D
point format with components px and py
std::ostream & operator<<(std::ostream &os, const component_format &cf)
stream out operator writes the component format in the syntax of description strings as defined in th...
unsigned find_best_match(const component_format &fmt, const char **format_descriptions, const component_format *fmt0, bool(*fmt1_better_match)(const component_format &fmt, const component_format &fmt1, const component_format &fmt2))
find the best matching format in a list of formats described by strings and return index of best matc...
ComponentIntegerInterpretation
define different interpretations of integer components
bool fmt1_compares_better(const component_format &fmt, const component_format &fmt1, const component_format &fmt2)
default function to check whether fmt1 is a better match to fmt than fmt2
TypeId
ids for the different types and type constructs
@ TI_INT64
signed integer stored in 32 bits
static T get(const void *ptr, TypeId tid)
return stored value converted into type T
static bool set(void *ptr, TypeId tid, const T &v)
convert value from type T and store it