Merge branch 'master' into astron-master

This commit is contained in:
Harvir 2016-06-29 17:09:13 -07:00
commit f8d45cd06e
9 changed files with 72 additions and 41 deletions

View File

@ -149,7 +149,7 @@ class FSM(DirectObject):
def __init__(self, name):
self.fsmLock = RLock()
self.name = name
self._name = name
self.stateArray = []
self._serialNum = FSM.SerialNum
FSM.SerialNum += 1
@ -185,7 +185,7 @@ class FSM(DirectObject):
# the messenger on every state change. The new and old states are
# accessible as self.oldState and self.newState, and the transition
# functions will already have been called.
return 'FSM-%s-%s-stateChange' % (self._serialNum, self.name)
return 'FSM-%s-%s-stateChange' % (self._serialNum, self._name)
def getCurrentFilter(self):
if not self.state:
@ -240,7 +240,7 @@ class FSM(DirectObject):
try:
assert isinstance(request, str)
self.notify.debug("%s.forceTransition(%s, %s" % (
self.name, request, str(args)[1:]))
self._name, request, str(args)[1:]))
if not self.state:
# Queue up the request.
@ -268,7 +268,7 @@ class FSM(DirectObject):
try:
assert isinstance(request, str)
self.notify.debug("%s.demand(%s, %s" % (
self.name, request, str(args)[1:]))
self._name, request, str(args)[1:]))
if not self.state:
# Queue up the request.
self.__requestQueue.append(PythonUtil.Functor(
@ -307,7 +307,7 @@ class FSM(DirectObject):
try:
assert isinstance(request, str)
self.notify.debug("%s.request(%s, %s" % (
self.name, request, str(args)[1:]))
self._name, request, str(args)[1:]))
filter = self.getCurrentFilter()
result = filter(request, args)
@ -385,7 +385,7 @@ class FSM(DirectObject):
# In either case, we quietly ignore unhandled command
# (lowercase) requests.
assert self.notify.debug("%s ignoring request %s from state %s." % (self.name, request, self.state))
assert self.notify.debug("%s ignoring request %s from state %s." % (self._name, request, self.state))
return None
def filterOff(self, request, args):
@ -444,7 +444,7 @@ class FSM(DirectObject):
# Internal function to change unconditionally to the indicated
# state.
assert self.state
assert self.notify.debug("%s to state %s." % (self.name, newState))
assert self.notify.debug("%s to state %s." % (self._name, newState))
self.oldState = self.state
self.newState = newState
@ -476,7 +476,7 @@ class FSM(DirectObject):
if self.__requestQueue:
request = self.__requestQueue.pop(0)
assert self.notify.debug("%s continued queued request." % (self.name))
assert self.notify.debug("%s continued queued request." % (self._name))
request()
def __callEnterFunc(self, name, *args):
@ -525,9 +525,9 @@ class FSM(DirectObject):
try:
className = self.__class__.__name__
if self.state:
str = ('%s FSM:%s in state "%s"' % (className, self.name, self.state))
str = ('%s FSM:%s in state "%s"' % (className, self._name, self.state))
else:
str = ('%s FSM:%s in transition from \'%s\' to \'%s\'' % (className, self.name, self.oldState, self.newState))
str = ('%s FSM:%s in transition from \'%s\' to \'%s\'' % (className, self._name, self.oldState, self.newState))
return str
finally:
self.fsmLock.release()

View File

@ -31,7 +31,7 @@ public:
* extended should create a specialization of this class template.
*/
template<class T>
class EXPCL_INTERROGATEDB Extension : public ExtensionBase<T> {
class Extension : public ExtensionBase<T> {
};
/**

View File

@ -40,7 +40,7 @@ Create_AudioManager_proc *AudioManager::_create_AudioManager = NULL;
void AudioManager::
register_AudioManager_creator(Create_AudioManager_proc* proc) {
nassertv(_create_AudioManager == NULL);
nassertv(_create_AudioManager == NULL || _create_AudioManager == proc);
_create_AudioManager = proc;
}

View File

@ -298,6 +298,15 @@ ConfigVariableBool allow_incomplete_render
"geometry is always paged in immediately when needed, holding up "
"the frame render if necessary."));
ConfigVariableBool old_alpha_blend
("old-alpha-blend", false,
PRC_DESC("Set this to true to enable the old alpha blending behavior from "
"Panda 1.9 in which the alpha value written out to the framebuffer "
"is squared. The new behavior is more intuitive when compositing "
"an semitransparent image produced using render-to-texture. You "
"should generally leave this false unless you have an effect that "
"relies on the old behavior, or you suspect an implementation bug."));
ConfigVariableInt win_size
("win-size", "800 600",
PRC_DESC("This is the default size at which to open a new window. This "

View File

@ -68,6 +68,7 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableBool default_stereo_camera;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool color_scale_via_lighting;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool alpha_scale_via_texture;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool allow_incomplete_render;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool old_alpha_blend;
extern EXPCL_PANDA_DISPLAY ConfigVariableInt win_size;
extern EXPCL_PANDA_DISPLAY ConfigVariableInt win_origin;

View File

@ -3798,7 +3798,14 @@ do_issue_blending() {
case TransparencyAttrib::M_multisample_mask:
case TransparencyAttrib::M_dual:
set_render_state(D3DRS_ALPHABLENDENABLE, TRUE);
set_render_state(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
if (old_alpha_blend) {
set_render_state(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
} else {
set_render_state(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
set_render_state(D3DRS_BLENDOPALPHA, D3DBLENDOP_ADD);
set_render_state(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
set_render_state(D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA);
}
set_render_state(D3DRS_BLENDOP, D3DBLENDOP_ADD);
set_render_state(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
set_render_state(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

View File

@ -7120,11 +7120,20 @@ do_issue_blending() {
enable_multisample_alpha_mask(false);
enable_blend(true);
_glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (old_alpha_blend) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} else {
_glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
if (GLCAT.is_spam()) {
GLCAT.spam() << "glBlendEquation(GL_FUNC_ADD)\n";
GLCAT.spam() << "glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)\n";
if (_supports_blend_equation_separate && !old_alpha_blend) {
GLCAT.spam() << "glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA)\n";
} else {
GLCAT.spam() << "glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)\n";
}
}
return;

View File

@ -544,32 +544,34 @@ assemble_text() {
}
}
if (properties->has_shadow()) {
if (!placement._glyph.is_null()) {
if (properties->has_shadow()) {
if (_dynamic_merge) {
if (placement._glyph->has_quad()) {
placement.assign_quad_to(quad_shadow_map, shadow_state, shadow);
} else {
placement.assign_append_to(geom_shadow_collector_map, shadow_state, shadow);
}
} else {
placement.assign_to(shadow_geom_node, shadow_state, shadow);
}
// Don't shadow the graphics. That can result in duplication of button
// objects, plus it looks weird. If you want a shadowed graphic, you
// can shadow it yourself before you add it.
// placement.copy_graphic_to(shadow_node, shadow_state, shadow);
any_shadow = true;
}
if (_dynamic_merge) {
if (placement._glyph->has_quad()) {
placement.assign_quad_to(quad_shadow_map, shadow_state, shadow);
placement.assign_quad_to(quad_map, text_state);
} else {
placement.assign_append_to(geom_shadow_collector_map, shadow_state, shadow);
placement.assign_append_to(geom_collector_map, text_state);
}
} else {
placement.assign_to(shadow_geom_node, shadow_state, shadow);
placement.assign_to(text_geom_node, text_state);
}
// Don't shadow the graphics. That can result in duplication of button
// objects, plus it looks weird. If you want a shadowed graphic, you
// can shadow it yourself before you add it.
// placement.copy_graphic_to(shadow_node, shadow_state, shadow);
any_shadow = true;
}
if (_dynamic_merge) {
if (placement._glyph->has_quad()) {
placement.assign_quad_to(quad_map, text_state);
} else {
placement.assign_append_to(geom_collector_map, text_state);
}
} else {
placement.assign_to(text_geom_node, text_state);
}
placement.copy_graphic_to(text_node, text_state);
}

View File

@ -107,23 +107,26 @@ typedef unsigned int PIXEL;
#define PCOMPONENT_BLEND(c1, c2, a2) \
((((unsigned int)(c1) * ((unsigned int)0xffff - (unsigned int)(a2)) + (unsigned int)(c2) * (unsigned int)(a2))) >> 16)
#define _BLEND_RGB(r1, g1, b1, r2, g2, b2, a2) \
#define PALPHA_BLEND(a1, a2) \
((((unsigned int)(a1) * ((unsigned int)0xffff - (unsigned int)(a2))) >> 16) + (unsigned int)(a2))
#define _BLEND_RGB(r1, g1, b1, a1, r2, g2, b2, a2) \
RGBA_TO_PIXEL(PCOMPONENT_BLEND(r1, r2, a2), \
PCOMPONENT_BLEND(g1, g2, a2), \
PCOMPONENT_BLEND(b1, b2, a2), \
a2)
PALPHA_BLEND(a1, a2))
#define _BLEND_SRGB(r1, g1, b1, r2, g2, b2, a2) \
#define _BLEND_SRGB(r1, g1, b1, a1, r2, g2, b2, a2) \
SRGBA_TO_PIXEL(PCOMPONENT_BLEND(r1, r2, a2), \
PCOMPONENT_BLEND(g1, g2, a2), \
PCOMPONENT_BLEND(b1, b2, a2), \
a2)
PALPHA_BLEND(a1, a2))
#define PIXEL_BLEND_RGB(rgb, r, g, b, a) \
_BLEND_RGB(PIXEL_R(rgb), PIXEL_G(rgb), PIXEL_B(rgb), r, g, b, a)
_BLEND_RGB(PIXEL_R(rgb), PIXEL_G(rgb), PIXEL_B(rgb), PIXEL_A(rgb), r, g, b, a)
#define PIXEL_BLEND_SRGB(rgb, r, g, b, a) \
_BLEND_SRGB(PIXEL_SR(rgb), PIXEL_SG(rgb), PIXEL_SB(rgb), r, g, b, a)
_BLEND_SRGB(PIXEL_SR(rgb), PIXEL_SG(rgb), PIXEL_SB(rgb), PIXEL_A(rgb), r, g, b, a)
typedef struct {