Hi,

I dont't mean to pollute the list, but unfortunately I have another
problem I can't find any solution for.
I'm using a ComponentTransform to scale some geometry I created, but
it just won't work.

Here's the code to create the geometry:
************************************************************
   // init as needed
   if(_highlightMaterial == NullFC)
   {
      _highlightMaterial = SimpleMaterial::create();

      beginEditCP(_highlightMaterial);
      _highlightMaterial->setDiffuse(Color3f(0,1,0));
      _highlightMaterial->setLit(false);
      endEditCP(_highlightMaterial);
   }
   if(_highlightNode == NullFC)
   {
      GeoPTypesPtr type = GeoPTypesUI8::create();
      beginEditCP(type);
      type->push_back(GL_LINE_STRIP);
      type->push_back(GL_LINES);
      endEditCP(type);

      GeoPLengthsPtr lens = GeoPLengthsUI32::create();
      beginEditCP(lens);
      lens->push_back(10);
      lens->push_back(6);
      endEditCP(lens);

      GeoIndicesUI32Ptr index = GeoIndicesUI32::create();
      beginEditCP(index);
      index->getFieldPtr()->push_back(0);
      index->getFieldPtr()->push_back(1);
      index->getFieldPtr()->push_back(3);
      index->getFieldPtr()->push_back(2);
      index->getFieldPtr()->push_back(0);
      index->getFieldPtr()->push_back(4);
      index->getFieldPtr()->push_back(5);
      index->getFieldPtr()->push_back(7);
      index->getFieldPtr()->push_back(6);
      index->getFieldPtr()->push_back(4);

      index->getFieldPtr()->push_back(1);
      index->getFieldPtr()->push_back(5);
      index->getFieldPtr()->push_back(2);
      index->getFieldPtr()->push_back(6);
      index->getFieldPtr()->push_back(3);
      index->getFieldPtr()->push_back(7);
      endEditCP(index);

      _highlightPoints = GeoPositions3f::create();
      beginEditCP(_highlightPoints);
      _highlightPoints->push_back(Pnt3f(-1, -1, -1));
      _highlightPoints->push_back(Pnt3f( 1, -1, -1));
      _highlightPoints->push_back(Pnt3f(-1,  1, -1));
      _highlightPoints->push_back(Pnt3f( 1,  1, -1));
      _highlightPoints->push_back(Pnt3f(-1, -1,  1));
      _highlightPoints->push_back(Pnt3f( 1, -1,  1));
      _highlightPoints->push_back(Pnt3f(-1,  1,  1));
      _highlightPoints->push_back(Pnt3f( 1,  1,  1));
      endEditCP(_highlightPoints);

      GeometryPtr _highlightGeo = Geometry::create();
      beginEditCP(_highlightGeo);
      _highlightGeo->setTypes(type);
      _highlightGeo->setLengths(lens);
      _highlightGeo->setIndices(index);
      _highlightGeo->setPositions(_highlightPoints);
      _highlightGeo->setMaterial(_highlightMaterial);
      endEditCP(_highlightGeo);
      addRefCP(_highlightGeo);

      _highlightNode = Node::create();
      beginEditCP(_highlightNode);
      _highlightNode->setCore(_highlightGeo);
      endEditCP(_highlightNode);
   }
   if(_highlightTransNode == NullFC)
   {
      _highlightTransNode = Node::create();
      _highlightTransCore = ComponentTransform::create();

      beginEditCP(_highlightTransCore, ComponentTransform::ScaleFieldMask);
         _highlightTransCore->setScale(Vec3f(1.0f, 1.0f, 1.0f));
      beginEditCP(_highlightTransCore, ComponentTransform::ScaleFieldMask);

      beginEditCP(_highlightTransNode, Node::ChildrenFieldMask |
Node::CoreFieldMask);
      {
         _highlightTransNode->setCore(_highlightTransCore);
         _highlightTransNode->addChild(_highlightNode);
      }
      endEditCP(_highlightTransNode, Node::ChildrenFieldMask |
Node::CoreFieldMask);
      addRefCP(_highlightTransNode);
   }

   beginEditCP(internalRoot);
      internalRoot->addChild(_highlightTransNode);
   endEditCP(internalRoot);

************************************************************

later on during the code I do the following:

   beginEditCP(_highlightTransCore);
      _highlightTransCore->setScale(scale);
   beginEditCP(_highlightTransCore);

***********************************************************

I can browse through the scenegraph using a tool which also shows all
the values in the nodes, so I know the scale field of the component
transform holds the right values. But still, no matter which values
are in the scale-field, the box doesn't get bigger or smaller.

Does Someone know what I'm doing wrong here?

Cheers,
Daniel


-- 
Daniel Wickeroth
Moltkestraße 88
50674 Köln

Home  0221 3569325
Work  0221 478 86502
Mobil 0176 700 40 252

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to