Panda3D
Loading...
Searching...
No Matches
vertexBufferContext.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file vertexBufferContext.h
10 * @author drose
11 * @date 2005-03-17
12 */
13
14#ifndef VERTEXBUFFERCONTEXT_H
15#define VERTEXBUFFERCONTEXT_H
16
17#include "pandabase.h"
18
19#include "bufferContext.h"
20#include "geomVertexArrayData.h"
22#include "adaptiveLru.h"
23
24/**
25 * This is a special class object that holds all the information returned by a
26 * particular GSG to indicate the vertex data array's internal context
27 * identifier.
28 *
29 * This allows the GSG to cache the vertex data array in whatever way makes
30 * sense. For instance, DirectX can allocate a vertex buffer for the array.
31 * OpenGL can create a buffer object.
32 */
33class EXPCL_PANDA_GOBJ VertexBufferContext : public BufferContext, public AdaptiveLruPage {
34public:
37
38PUBLISHED:
39 INLINE GeomVertexArrayData *get_data() const;
40
41 INLINE bool changed_size(const GeomVertexArrayDataHandle *reader) const;
42 INLINE bool changed_usage_hint(const GeomVertexArrayDataHandle *reader) const;
43 INLINE bool was_modified(const GeomVertexArrayDataHandle *reader) const;
44
45public:
46 INLINE void update_data_size_bytes(size_t new_data_size_bytes);
47 INLINE void mark_loaded(const GeomVertexArrayDataHandle *reader);
48 INLINE void mark_unloaded();
49
50 virtual void output(std::ostream &out) const;
51 virtual void write(std::ostream &out, int indent_level) const;
52
53private:
54 GeomEnums::UsageHint _usage_hint;
55
56public:
57 static TypeHandle get_class_type() {
58 return _type_handle;
59 }
60 static void init_type() {
61 BufferContext::init_type();
62 register_type(_type_handle, "VertexBufferContext",
63 BufferContext::get_class_type());
64 }
65 virtual TypeHandle get_type() const {
66 return get_class_type();
67 }
68 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
69
70private:
71 static TypeHandle _type_handle;
72
73 friend class PreparedGraphicsObjects;
74};
75
76inline std::ostream &operator << (std::ostream &out, const VertexBufferContext &context) {
77 context.output(out);
78 return out;
79}
80
81#include "vertexBufferContext.I"
82
83#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
One atomic piece that may be managed by a AdaptiveLru chain.
This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial...
void update_data_size_bytes(size_t new_data_size_bytes)
Should be called (usually by a derived class) when the on-card size of this object has changed.
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
This is the data for one array of a GeomVertexData structure.
A table of objects that are saved within the graphics context for reference by handle later.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is a special class object that holds all the information returned by a particular GSG to indicat...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.