mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
regen from glgsg
This commit is contained in:
parent
c84569bf73
commit
8158b85aaf
@ -71,8 +71,15 @@
|
||||
#include "depthTestAttrib.h"
|
||||
#include "depthWriteAttrib.h"
|
||||
#include "colorWriteAttrib.h"
|
||||
#include "texMatrixAttrib.h"
|
||||
#include "materialAttrib.h"
|
||||
#include "renderModeAttrib.h"
|
||||
#include "fogAttrib.h"
|
||||
#include "depthOffsetAttrib.h"
|
||||
#include "qpfog.h"
|
||||
#include "clockObject.h"
|
||||
#include "string_utils.h"
|
||||
#include "qpnodePath.h"
|
||||
#include "dcast.h"
|
||||
#include "pvector.h"
|
||||
|
||||
@ -2498,6 +2505,37 @@ apply_fog(Fog *fog) {
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::apply_fog
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
apply_fog(qpFog *fog) {
|
||||
qpFog::Mode fmode = fog->get_mode();
|
||||
call_glFogMode(get_fog_mode_type((Fog::Mode)fmode));
|
||||
|
||||
if (fmode == qpFog::M_linear) {
|
||||
// Linear fog may be world-relative or camera-relative. The fog
|
||||
// object knows how to decode its parameters into camera-relative
|
||||
// properties.
|
||||
float onset, opaque;
|
||||
fog->compute_linear_range(onset, opaque,
|
||||
qpNodePath(),
|
||||
// _current_camera,
|
||||
_coordinate_system);
|
||||
call_glFogStart(onset);
|
||||
call_glFogEnd(opaque);
|
||||
|
||||
} else {
|
||||
// Exponential fog is always camera-relative.
|
||||
call_glFogDensity(fog->get_exp_density());
|
||||
}
|
||||
|
||||
call_glFogColor(fog->get_color());
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::apply_light
|
||||
// Access: Public, Virtual
|
||||
@ -3438,6 +3476,18 @@ issue_transform(const TransformState *transform) {
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_tex_matrix
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_tex_matrix(const TexMatrixAttrib *attrib) {
|
||||
chromium.MatrixMode(GL_TEXTURE);
|
||||
chromium.LoadMatrixf(attrib->get_mat().get_data());
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_texture
|
||||
// Access: Public, Virtual
|
||||
@ -3456,6 +3506,46 @@ issue_texture(const TextureAttrib *attrib) {
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_material
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_material(const MaterialAttrib *attrib) {
|
||||
const Material *material = attrib->get_material();
|
||||
if (material != (const Material *)NULL) {
|
||||
apply_material(material);
|
||||
}
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_render_mode
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_render_mode(const RenderModeAttrib *attrib) {
|
||||
RenderModeAttrib::Mode mode = attrib->get_mode();
|
||||
|
||||
switch (mode) {
|
||||
case RenderModeAttrib::M_filled:
|
||||
call_glPolygonMode(GL_FILL);
|
||||
break;
|
||||
|
||||
case RenderModeAttrib::M_wireframe:
|
||||
call_glLineWidth(attrib->get_line_width());
|
||||
call_glPolygonMode(GL_LINE);
|
||||
break;
|
||||
|
||||
default:
|
||||
crgsg_cat.error()
|
||||
<< "Unknown render mode " << (int)mode << endl;
|
||||
}
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_texture_apply
|
||||
// Access: Public, Virtual
|
||||
@ -3468,6 +3558,55 @@ issue_texture_apply(const TextureApplyAttrib *attrib) {
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_color_write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_color_write(const ColorWriteAttrib *attrib) {
|
||||
ColorWriteAttrib::Mode mode = attrib->get_mode();
|
||||
if (mode == ColorWriteAttrib::M_off) {
|
||||
chromium.ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
} else {
|
||||
chromium.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
}
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_depth_test
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_depth_test(const DepthTestAttrib *attrib) {
|
||||
DepthTestAttrib::Mode mode = attrib->get_mode();
|
||||
if (mode == DepthTestAttrib::M_none) {
|
||||
enable_depth_test(false);
|
||||
} else {
|
||||
enable_depth_test(true);
|
||||
chromium.DepthFunc(get_depth_func_type(mode));
|
||||
}
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_depth_write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_depth_write(const DepthWriteAttrib *attrib) {
|
||||
DepthWriteAttrib::Mode mode = attrib->get_mode();
|
||||
if (mode == DepthWriteAttrib::M_off) {
|
||||
chromium.DepthMask(GL_FALSE);
|
||||
} else {
|
||||
chromium.DepthMask(GL_TRUE);
|
||||
}
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_cull_face
|
||||
// Access: Public, Virtual
|
||||
@ -3560,51 +3699,42 @@ issue_transparency(const TransparencyAttrib *attrib) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_color_write
|
||||
// Function: CRGraphicsStateGuardian::issue_fog
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_color_write(const ColorWriteAttrib *attrib) {
|
||||
ColorWriteAttrib::Mode mode = attrib->get_mode();
|
||||
if (mode == ColorWriteAttrib::M_off) {
|
||||
chromium.ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
issue_fog(const FogAttrib *attrib) {
|
||||
if (!attrib->is_off()) {
|
||||
enable_fog(true);
|
||||
qpFog *fog = attrib->get_fog();
|
||||
nassertv(fog != (qpFog *)NULL);
|
||||
apply_fog(fog);
|
||||
} else {
|
||||
chromium.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
enable_fog(false);
|
||||
}
|
||||
report_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_depth_test
|
||||
// Function: CRGraphicsStateGuardian::issue_depth_offset
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_depth_test(const DepthTestAttrib *attrib) {
|
||||
DepthTestAttrib::Mode mode = attrib->get_mode();
|
||||
if (mode == DepthTestAttrib::M_none) {
|
||||
enable_depth_test(false);
|
||||
} else {
|
||||
enable_depth_test(true);
|
||||
chromium.DepthFunc(get_depth_func_type(mode));
|
||||
}
|
||||
report_errors();
|
||||
}
|
||||
issue_depth_offset(const DepthOffsetAttrib *attrib) {
|
||||
int offset = attrib->get_offset();
|
||||
|
||||
if (offset != 0) {
|
||||
GLfloat newfactor = 1.0f;
|
||||
GLfloat newunits = (GLfloat)offset;
|
||||
chromium.PolygonOffset(newfactor, newunits);
|
||||
enable_polygon_offset(true);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CRGraphicsStateGuardian::issue_depth_write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
issue_depth_write(const DepthWriteAttrib *attrib) {
|
||||
DepthWriteAttrib::Mode mode = attrib->get_mode();
|
||||
if (mode == DepthWriteAttrib::M_off) {
|
||||
chromium.DepthMask(GL_FALSE);
|
||||
} else {
|
||||
chromium.DepthMask(GL_TRUE);
|
||||
enable_polygon_offset(false);
|
||||
}
|
||||
|
||||
report_errors();
|
||||
}
|
||||
|
||||
|
@ -139,6 +139,7 @@ public:
|
||||
|
||||
virtual void apply_material(const Material *material);
|
||||
virtual void apply_fog(Fog *fog);
|
||||
void apply_fog(qpFog *fog);
|
||||
|
||||
virtual void apply_light(PointLight* light);
|
||||
virtual void apply_light(DirectionalLight* light);
|
||||
@ -170,13 +171,25 @@ public:
|
||||
virtual void issue_polygon_offset(const PolygonOffsetTransition *attrib);
|
||||
|
||||
virtual void issue_transform(const TransformState *transform);
|
||||
// virtual void issue_color_scale(const ColorScaleAttrib *attrib);
|
||||
// virtual void issue_color(const ColorAttrib *attrib);
|
||||
virtual void issue_tex_matrix(const TexMatrixAttrib *attrib);
|
||||
virtual void issue_texture(const TextureAttrib *attrib);
|
||||
// virtual void issue_light(const LightAttrib *attrib);
|
||||
virtual void issue_material(const MaterialAttrib *attrib);
|
||||
virtual void issue_render_mode(const RenderModeAttrib *attrib);
|
||||
virtual void issue_texture_apply(const TextureApplyAttrib *attrib);
|
||||
virtual void issue_cull_face(const CullFaceAttrib *attrib);
|
||||
virtual void issue_transparency(const TransparencyAttrib *attrib);
|
||||
virtual void issue_color_write(const ColorWriteAttrib *attrib);
|
||||
virtual void issue_depth_test(const DepthTestAttrib *attrib);
|
||||
virtual void issue_depth_write(const DepthWriteAttrib *attrib);
|
||||
virtual void issue_cull_face(const CullFaceAttrib *attrib);
|
||||
virtual void issue_transparency(const TransparencyAttrib *attrib);
|
||||
virtual void issue_fog(const FogAttrib *attrib);
|
||||
virtual void issue_depth_offset(const DepthOffsetAttrib *attrib);
|
||||
// virtual void issue_color_blend(const ColorBlendAttrib *attrib);
|
||||
// virtual void issue_tex_gen(const TexGenAttrib *attrib);
|
||||
// virtual void issue_stencil(const StencilAttrib *attrib);
|
||||
// virtual void issue_clip_plane(const ClipPlaneAttrib *attrib);
|
||||
|
||||
virtual bool wants_normals(void) const;
|
||||
virtual bool wants_texcoords(void) const;
|
||||
@ -379,7 +392,7 @@ protected:
|
||||
|
||||
public:
|
||||
static GraphicsStateGuardian *
|
||||
make_GlGraphicsStateGuardian(const FactoryParams ¶ms);
|
||||
make_GlGraphicsStateGuardian(const FactoryParams ¶ms);
|
||||
|
||||
static TypeHandle get_class_type(void);
|
||||
static void init_type(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user