mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
Support rendering without any vertex arrays bound better
This commit is contained in:
parent
40acfeffb5
commit
6225755230
@ -2196,7 +2196,10 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
|
|||||||
bool force) {
|
bool force) {
|
||||||
_munger = munger;
|
_munger = munger;
|
||||||
_data_reader = data_reader;
|
_data_reader = data_reader;
|
||||||
return _data_reader->has_vertex();
|
|
||||||
|
// Always draw if we have a shader, since the shader might use a different
|
||||||
|
// mechanism for fetching vertex data.
|
||||||
|
return _data_reader->has_vertex() || (_target_shader && _target_shader->has_shader());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2231,7 +2231,8 @@ get_num_primitives() const {
|
|||||||
*/
|
*/
|
||||||
bool GeomPrimitivePipelineReader::
|
bool GeomPrimitivePipelineReader::
|
||||||
check_valid(const GeomVertexDataPipelineReader *data_reader) const {
|
check_valid(const GeomVertexDataPipelineReader *data_reader) const {
|
||||||
if (get_num_vertices() != 0 &&
|
if (get_num_vertices() != 0 &&
|
||||||
|
data_reader->get_num_arrays() > 0 &&
|
||||||
get_max_vertex() >= data_reader->get_num_rows()) {
|
get_max_vertex() >= data_reader->get_num_rows()) {
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -235,6 +235,15 @@ get_morph_delta(size_t n) const {
|
|||||||
return _morphs[n]._delta;
|
return _morphs[n]._delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a standard vertex format containing no arrays at all, useful for
|
||||||
|
* pull-style vertex rendering.
|
||||||
|
*/
|
||||||
|
INLINE const GeomVertexFormat *GeomVertexFormat::
|
||||||
|
get_empty() {
|
||||||
|
return get_registry()->_empty;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a standard vertex format with just a 3-component vertex position.
|
* Returns a standard vertex format with just a 3-component vertex position.
|
||||||
*/
|
*/
|
||||||
|
@ -890,6 +890,8 @@ Registry() {
|
|||||||
*/
|
*/
|
||||||
void GeomVertexFormat::Registry::
|
void GeomVertexFormat::Registry::
|
||||||
make_standard_formats() {
|
make_standard_formats() {
|
||||||
|
_empty = register_format(new GeomVertexFormat);
|
||||||
|
|
||||||
_v3 = register_format(new GeomVertexArrayFormat
|
_v3 = register_format(new GeomVertexArrayFormat
|
||||||
(InternalName::get_vertex(), 3,
|
(InternalName::get_vertex(), 3,
|
||||||
NT_stdfloat, C_point));
|
NT_stdfloat, C_point));
|
||||||
@ -1011,10 +1013,6 @@ register_format(GeomVertexFormat *format) {
|
|||||||
new_format = (*fi);
|
new_format = (*fi);
|
||||||
if (!new_format->is_registered()) {
|
if (!new_format->is_registered()) {
|
||||||
new_format->do_register();
|
new_format->do_register();
|
||||||
if (new_format->get_num_arrays() == 0) {
|
|
||||||
gobj_cat.warning()
|
|
||||||
<< "Empty GeomVertexFormat registered.\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +125,8 @@ PUBLISHED:
|
|||||||
void write_with_data(ostream &out, int indent_level,
|
void write_with_data(ostream &out, int indent_level,
|
||||||
const GeomVertexData *data) const;
|
const GeomVertexData *data) const;
|
||||||
|
|
||||||
|
INLINE static const GeomVertexFormat *get_empty();
|
||||||
|
|
||||||
// Some standard vertex formats. No particular requirement to use one of
|
// Some standard vertex formats. No particular requirement to use one of
|
||||||
// these, but the DirectX renderers can use these formats directly, whereas
|
// these, but the DirectX renderers can use these formats directly, whereas
|
||||||
// any other format will have to be converted first.
|
// any other format will have to be converted first.
|
||||||
@ -227,6 +229,8 @@ private:
|
|||||||
Formats _formats;
|
Formats _formats;
|
||||||
LightReMutex _lock;
|
LightReMutex _lock;
|
||||||
|
|
||||||
|
CPT(GeomVertexFormat) _empty;
|
||||||
|
|
||||||
CPT(GeomVertexFormat) _v3;
|
CPT(GeomVertexFormat) _v3;
|
||||||
CPT(GeomVertexFormat) _v3n3;
|
CPT(GeomVertexFormat) _v3n3;
|
||||||
CPT(GeomVertexFormat) _v3t2;
|
CPT(GeomVertexFormat) _v3t2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user