*** empty log message ***

This commit is contained in:
David Rose 2001-07-05 21:32:07 +00:00
parent 1f24c4da3c
commit 78205035e1
5 changed files with 99 additions and 6 deletions

View File

@ -205,8 +205,8 @@ setup(const string &label) {
style.set_color(0.9, 0.9, 0.9, 1.0);
set_frame_style(S_rollover, style);
ColorTransition *col_trans = new ColorTransition(Colorf(0.8, 0.8, 0.8, 1.0));
inact->set_transition(col_trans);
ColorTransition *ct = new ColorTransition(Colorf(0.8, 0.8, 0.8, 1.0));
inact->set_transition(ct);
style.set_color(0.6, 0.6, 0.6, 1.0);
set_frame_style(S_inactive, style);
@ -214,8 +214,8 @@ setup(const string &label) {
style.set_color(0.8, 0.8, 0.8, 1.0);
set_frame_style(S_depressed, style);
LMatrix4f translate = LMatrix4f::translate_mat(0.05, 0.0, -0.05);
TransformTransition *ttrans = new TransformTransition(translate);
down->set_transition(ttrans);
TransformTransition *tt = new TransformTransition(translate);
down->set_transition(tt);
}
////////////////////////////////////////////////////////////////////

View File

@ -54,6 +54,43 @@ output(ostream &out) const {
out << _type << " color = " << _color << " width = " << _width;
}
////////////////////////////////////////////////////////////////////
// Function: PGFrameStyle::xform
// Access: Public
// Description: Applies the indicated transform to the FrameStyle.
// The return value is true if the frame style is
// transformed, or false if it was not affected by the
// transform.
////////////////////////////////////////////////////////////////////
bool PGFrameStyle::
xform(const LMatrix4f &mat) {
// All we can do is scale the X and Y bevel sizes.
// Extract the X and Z axes from the matrix.
LVector3f x, z;
mat.get_row3(x, 0);
float x_scale = x.length();
mat.get_row3(z, 2);
float z_scale = z.length();
_width[0] *= x_scale;
_width[1] *= z_scale;
switch (_type) {
case T_none:
case T_flat:
return false;
case T_bevel_out:
case T_bevel_in:
return true;
}
// Shouldn't get here, but this makes the compiler happy.
return true;
}
////////////////////////////////////////////////////////////////////
// Function: PGFrameStyle::generate_into
// Access: Public
@ -106,7 +143,7 @@ generate_into(Node *node, const LVecBase4f &frame) {
////////////////////////////////////////////////////////////////////
// Function: PGFrameStyle::generate_flat_geom
// Access: Public
// Access: Private
// Description: Generates the GeomNode appropriate to a T_flat
// frame.
////////////////////////////////////////////////////////////////////
@ -144,7 +181,7 @@ generate_flat_geom(const LVecBase4f &frame) {
////////////////////////////////////////////////////////////////////
// Function: PGFrameStyle::generate_bevel_geom
// Access: Public
// Access: Private
// Description: Generates the GeomNode appropriate to a T_bevel_in or
// T_bevel_out frame.
////////////////////////////////////////////////////////////////////

View File

@ -60,6 +60,7 @@ PUBLISHED:
void output(ostream &out) const;
public:
bool xform(const LMatrix4f &mat);
NodeRelation *generate_into(Node *node, const LVecBase4f &frame);
private:

View File

@ -23,6 +23,8 @@
#include "throw_event.h"
#include "string_utils.h"
#include "arcChain.h"
#include "transformTransition.h"
#include "sceneGraphReducer.h"
TypeHandle PGItem::_type_handle;
PT(TextNode) PGItem::_text_node;
@ -96,6 +98,58 @@ make_copy() const {
return new PGItem(*this);
}
////////////////////////////////////////////////////////////////////
// Function: PGItem::xform
// Access: Public, Virtual
// Description: Transforms the contents of this node by the indicated
// matrix, if it means anything to do so. For most
// kinds of nodes, this does nothing.
////////////////////////////////////////////////////////////////////
void PGItem::
xform(const LMatrix4f &mat) {
// Transform the frame.
LPoint3f ll(_frame[0], 0.0, _frame[2]);
LPoint3f ur(_frame[1], 0.0, _frame[3]);
ll = ll * mat;
ur = ur * mat;
_frame.set(ll[0], ur[0], ll[2], ur[2]);
// Transform the individual states and their frame styles.
StateDefs::iterator di;
for (di = _state_defs.begin(); di != _state_defs.end(); ++di) {
Node *node = (*di)._node;
if (node != (Node *)NULL) {
// Apply the matrix to the previous transform on all the arcs
// here.
int num_children = node->get_num_children(RenderRelation::get_class_type());
for (int i = 0; i < num_children; i++) {
NodeRelation *arc = node->get_child(RenderRelation::get_class_type(), i);
if (arc != (*di)._frame_arc) {
LMatrix4f arc_mat;
TransformTransition *tt;
if (!get_transition_into(tt, arc)) {
// No previous transform.
arc_mat = mat;
} else {
arc_mat = tt->get_matrix() * mat;
}
tt = new TransformTransition(arc_mat);
arc->set_transition(tt);
// Now flatten the transform into the subgraph.
SceneGraphReducer gr;
gr.apply_transitions(arc);
}
}
}
// Transform the frame style too.
if ((*di)._frame_style.xform(mat)) {
(*di)._frame_stale = true;
}
}
}
////////////////////////////////////////////////////////////////////
// Function: PGItem::activate_region
// Access: Public, Virtual

View File

@ -58,6 +58,7 @@ public:
void operator = (const PGItem &copy);
virtual Node *make_copy() const;
virtual void xform(const LMatrix4f &mat);
void activate_region(const LMatrix4f &transform, int sort);
INLINE PGMouseWatcherRegion *get_region() const;