|
@@ -24,6 +24,8 @@
|
|
|
#include "colorAttrib.h"
|
|
#include "colorAttrib.h"
|
|
|
#include "textureAttrib.h"
|
|
#include "textureAttrib.h"
|
|
|
#include "cullFaceAttrib.h"
|
|
#include "cullFaceAttrib.h"
|
|
|
|
|
+#include "transparencyAttrib.h"
|
|
|
|
|
+#include "depthWriteAttrib.h"
|
|
|
#include "lodNode.h"
|
|
#include "lodNode.h"
|
|
|
#include "switchNode.h"
|
|
#include "switchNode.h"
|
|
|
#include "sequenceNode.h"
|
|
#include "sequenceNode.h"
|
|
@@ -32,6 +34,7 @@
|
|
|
#include "collisionPlane.h"
|
|
#include "collisionPlane.h"
|
|
|
#include "collisionSphere.h"
|
|
#include "collisionSphere.h"
|
|
|
#include "collisionInvSphere.h"
|
|
#include "collisionInvSphere.h"
|
|
|
|
|
+#include "textureStage.h"
|
|
|
#include "geomNode.h"
|
|
#include "geomNode.h"
|
|
|
#include "geom.h"
|
|
#include "geom.h"
|
|
|
#include "geomTriangles.h"
|
|
#include "geomTriangles.h"
|
|
@@ -46,6 +49,7 @@
|
|
|
#include "eggPolygon.h"
|
|
#include "eggPolygon.h"
|
|
|
#include "eggTexture.h"
|
|
#include "eggTexture.h"
|
|
|
#include "eggMaterial.h"
|
|
#include "eggMaterial.h"
|
|
|
|
|
+#include "eggRenderMode.h"
|
|
|
#include "somethingToEggConverter.h"
|
|
#include "somethingToEggConverter.h"
|
|
|
#include "dcast.h"
|
|
#include "dcast.h"
|
|
|
#include "pystub.h"
|
|
#include "pystub.h"
|
|
@@ -448,6 +452,39 @@ convert_triangles(const GeomVertexData *vertex_data,
|
|
|
egg_tex = get_egg_texture(ta->get_texture());
|
|
egg_tex = get_egg_texture(ta->get_texture());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Check the texture environment
|
|
|
|
|
+ if ((ta != (const TextureAttrib *)NULL) && (egg_tex != (const EggTexture *)NULL)) {
|
|
|
|
|
+ TextureStage* tex_stage = ta->get_on_stage(0);
|
|
|
|
|
+ if (tex_stage != (const TextureStage *)NULL) {
|
|
|
|
|
+ switch (tex_stage->get_mode()) {
|
|
|
|
|
+ case TextureStage::M_modulate:
|
|
|
|
|
+ if (has_color_off == true) {
|
|
|
|
|
+ egg_tex->set_env_type(EggTexture::ET_replace);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ egg_tex->set_env_type(EggTexture::ET_modulate);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TextureStage::M_decal:
|
|
|
|
|
+ egg_tex->set_env_type(EggTexture::ET_decal);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TextureStage::M_blend:
|
|
|
|
|
+ egg_tex->set_env_type(EggTexture::ET_blend);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TextureStage::M_replace:
|
|
|
|
|
+ egg_tex->set_env_type(EggTexture::ET_replace);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TextureStage::M_add:
|
|
|
|
|
+ egg_tex->set_env_type(EggTexture::ET_add);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TextureStage::M_blend_color_scale:
|
|
|
|
|
+ egg_tex->set_env_type(EggTexture::ET_blend_color_scale);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Check the backface flag.
|
|
// Check the backface flag.
|
|
|
bool bface = false;
|
|
bool bface = false;
|
|
|
const RenderAttrib *cf_attrib = net_state->get_attrib(CullFaceAttrib::get_class_type());
|
|
const RenderAttrib *cf_attrib = net_state->get_attrib(CullFaceAttrib::get_class_type());
|
|
@@ -458,6 +495,61 @@ convert_triangles(const GeomVertexData *vertex_data,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Check the depth write flag - only needed for AM_blend_no_occlude
|
|
|
|
|
+ bool has_depthwrite = false;
|
|
|
|
|
+ DepthWriteAttrib::Mode depthwrite = DepthWriteAttrib::M_on;
|
|
|
|
|
+ const RenderAttrib *dw_attrib = net_state->get_attrib(DepthWriteAttrib::get_class_type());
|
|
|
|
|
+ if (dw_attrib != (const RenderAttrib *)NULL) {
|
|
|
|
|
+ const DepthWriteAttrib *dwa = DCAST(DepthWriteAttrib, dw_attrib);
|
|
|
|
|
+ depthwrite = dwa->get_mode();
|
|
|
|
|
+ has_depthwrite = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Check the transparency flag.
|
|
|
|
|
+ bool has_transparency = false;
|
|
|
|
|
+ TransparencyAttrib::Mode transparency = TransparencyAttrib::M_none;
|
|
|
|
|
+ const RenderAttrib *tr_attrib = net_state->get_attrib(TransparencyAttrib::get_class_type());
|
|
|
|
|
+ if (tr_attrib != (const RenderAttrib *)NULL) {
|
|
|
|
|
+ const TransparencyAttrib *tra = DCAST(TransparencyAttrib, tr_attrib);
|
|
|
|
|
+ transparency = tra->get_mode();
|
|
|
|
|
+ has_transparency = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (has_transparency && (egg_tex != (EggTexture *)NULL)) {
|
|
|
|
|
+ EggRenderMode::AlphaMode tex_trans = EggRenderMode::AM_unspecified;
|
|
|
|
|
+ switch (transparency) {
|
|
|
|
|
+ case TransparencyAttrib::M_none:
|
|
|
|
|
+ tex_trans = EggRenderMode::AM_off;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TransparencyAttrib::M_alpha:
|
|
|
|
|
+ if (has_depthwrite && (depthwrite == DepthWriteAttrib::M_off)) {
|
|
|
|
|
+ tex_trans = EggRenderMode::AM_blend_no_occlude;
|
|
|
|
|
+ has_depthwrite = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tex_trans = EggRenderMode::AM_blend;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TransparencyAttrib::M_multisample:
|
|
|
|
|
+ tex_trans = EggRenderMode::AM_ms;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TransparencyAttrib::M_multisample_mask:
|
|
|
|
|
+ tex_trans = EggRenderMode::AM_ms_mask;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TransparencyAttrib::M_binary:
|
|
|
|
|
+ tex_trans = EggRenderMode::AM_binary;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TransparencyAttrib::M_dual:
|
|
|
|
|
+ tex_trans = EggRenderMode::AM_dual;
|
|
|
|
|
+ break;
|
|
|
|
|
+ default: // intentional fall-through
|
|
|
|
|
+ case TransparencyAttrib::M_notused:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (tex_trans != EggRenderMode::AM_unspecified) {
|
|
|
|
|
+ egg_tex->set_alpha_mode(tex_trans);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Normalf normal;
|
|
Normalf normal;
|
|
|
Colorf color;
|
|
Colorf color;
|
|
|
|
|
|