Sfoglia il codice sorgente

*** empty log message ***

David Rose 24 anni fa
parent
commit
7810aff393

+ 2 - 1
panda/src/collide/collisionPolygon.cxx

@@ -617,6 +617,7 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) {
   nassertv(_points.size() >= 3);
 
 #ifndef NDEBUG
+  /*
   // Now make sure the points define a convex polygon.
   if (is_concave()) {
     collide_cat.error() << "Invalid concave CollisionPolygon defined:\n";
@@ -627,8 +628,8 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) {
     collide_cat.error(false) 
       << "  normal " << normal << " with length " << normal.length() << "\n";
     _points.clear();
-    nassertv(false);
   }
+  */
 #endif
 
   // Now average up all the points to get the median.  This is the

+ 5 - 4
panda/src/framework/framework.cxx

@@ -140,7 +140,7 @@ RenderRelation *framerate_arc = (RenderRelation*)0L;
 PT_NamedNode framerate_node;
 
 PT(GraphicsLayer) framerate_layer;
-PT_Node framerate_font;
+PT(TextFont) framerate_font;
 PT(TextNode) framerate_text;
 
 Loader loader;
@@ -502,9 +502,10 @@ void setup_framerate(void) {
   dr->set_camera(cam2d);
 
   // load the font
-  framerate_font = loader.load_sync("cmtt12");
+  PT_Node font_model = loader.load_sync("cmtt12");
 
-  if (framerate_font != (NamedNode *)0L) {
+  if (font_model != (NamedNode *)0L) {
+    framerate_font = new TextFont(font_model);
     framerate_text = new TextNode("framerate_text");
     new RenderRelation(framerate_node, framerate_text);
 
@@ -512,7 +513,7 @@ void setup_framerate(void) {
       LMatrix4f::translate_mat(-0.95, 0.0, 0.95);
 
     framerate_text->set_transform(mat);
-    framerate_text->set_font(framerate_font.p());
+    framerate_text->set_font(framerate_font);
     framerate_text->set_card_color(0.5, 0.5, 0.5, 0.5);
     framerate_text->set_card_as_margin(0.5, 0.5, 0.2, 0.2);
     framerate_text->set_frame_color(1., 0., 0., 1.);

+ 1 - 1
panda/src/gui/guiLabel.cxx

@@ -207,7 +207,7 @@ GuiLabel* GuiLabel::make_simple_texture_label(Texture* texture) {
   return ret;
 }
 
-GuiLabel* GuiLabel::make_simple_text_label(const string& text, Node* font,
+GuiLabel* GuiLabel::make_simple_text_label(const string& text, TextFont* font,
 					   Texture* tex) {
   GuiLabel* ret = new GuiLabel();
   ret->_type = SIMPLE_TEXT;

+ 2 - 1
panda/src/gui/guiLabel.h

@@ -19,6 +19,7 @@
 // label-ish behavior for GUI objects (labels, buttons, rollovers)
 
 class GuiManager;
+class TextFont;
 
 class EXPCL_PANDA GuiLabel : public TypedReferenceCount {
 PUBLISHED:
@@ -70,7 +71,7 @@ PUBLISHED:
   virtual ~GuiLabel(void);
 
   static GuiLabel* make_simple_texture_label(Texture*);
-  static GuiLabel* make_simple_text_label(const string&, Node*,
+  static GuiLabel* make_simple_text_label(const string&, TextFont*,
 					  Texture* = (Texture*)0L);
   static GuiLabel* make_simple_card_label(void);
   static GuiLabel* make_null_label(void);

+ 15 - 0
panda/src/text/textNode.I

@@ -73,6 +73,21 @@ thaw() {
   return _freeze_level;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: TextNode::set_font
+//       Access: Published
+//  Description: Sets the font that will be used when making text.
+////////////////////////////////////////////////////////////////////
+INLINE void TextNode::
+set_font(Node *font_node) {
+  if (font_node == (Node *)NULL) {
+    _font = (TextFont *)NULL;
+  } else {
+    _font = new TextFont(font_node);
+  }
+  rebuild(true);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: TextNode::set_font
 //       Access: Published

+ 1 - 0
panda/src/text/textNode.h

@@ -46,6 +46,7 @@ PUBLISHED:
   INLINE int get_freeze_level() const;
   INLINE int thaw();
 
+  INLINE void set_font(Node *font_node);
   INLINE void set_font(TextFont *font);
   INLINE TextFont *get_font() const;