[Soc-2009-dev] Weekly report - Collada module

Chingiz Dyussenov chingiz.ds at gmail.com
Mon Jun 15 18:52:54 CEST 2009


I'm sorry but I can't apply the patch the latest revision in
https://opencollada.svn.sourceforge.net/svnroot/opencollada/trunk is 568 and
the diff is against 587.

Now I am going switch to coding a basic importer, so this can wait.

Chingiz

On Mon, Jun 15, 2009 at 10:01 PM, Sebastian <sebastian at opencollada.org>wrote:

> patch attached ;) not tested yet.
> sebastian
>
>
> Chingiz Dyussenov wrote:
>
>> Hi, Sebastian,
>>
>> I've got a problem. I can't create <bind_vertex_input> in
>> <instance_material> with OpenCollada. I need this to make the connection
>> between the <texture>’s texcoord attribute and the mesh’s texture coordinate
>> array.
>>
>> Chingiz
>>
>> On Tue, Jun 9, 2009 at 10:32 PM, Sebastian <sebastian at opencollada.org<mailto:
>> sebastian at opencollada.org>> wrote:
>>
>>    Hi Arystan,
>>
>>    thanks a lot for the bug report! We precompiled the regular expressions
>>    by intention to remove dependency to "pcre_compile" and to speed up
>>    overall processing time. I must admit that this sounds a little bit
>> like
>>    an overkill but the code generation for XSD Schema automatically
>>    generates the statements.
>>
>>    We have to check why the precompiled statements failed :(
>>
>>    Sebastian
>>
>>
>>    Arystan Dyussenov wrote:
>>     > Hi, Sebastian,
>>     >
>>     > I'm Arystan, Chingiz's elder brother. I'm helping him a bit with
>>     > OpenCollada studying. Recently we've stumbled upon a bug in
>>    OpenCollada.
>>     >
>>     > The following code resulted in an empty URL on his Intel Celeron:
>>     >
>>     > COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, "#id")
>>     >
>>     > On my AMD Athlon 64 however it worked ok. We're both using Linux.
>>     > Debugging revealed that regexp matcher didn't accept a correct URI
>>     > ("#something") on his computer. The problem turned out to be in
>>    compiled
>>     > regexps.
>>     >
>>     > I'm attaching the diff of the fix, regexps are now compiled on
>>    runtime
>>     > only once on demand. Although correctness of regexps needs to be
>>    checked.
>>     >
>>     > Arystan
>>     >
>>     > On Sun, May 24, 2009 at 10:40 PM, Sebastian
>>    <sebastian at opencollada.org <mailto:sebastian at opencollada.org>
>>     > <mailto:sebastian at opencollada.org
>>
>>    <mailto:sebastian at opencollada.org>>> wrote:
>>     >
>>     >     Great to hear about that! The most complete examples are the
>>    3ds Max and
>>     >     Maya converters itself, though they might be difficult in
>>    some areas as
>>     >     they use the specific max/maya APIs, too.
>>     >
>>     >     I already started (in my spare time) a native c++
>>    Importer/Exporter for
>>     >     Blender. I liked the performance of the native VRML/STL/DXF
>>     >     importer/exporter that are available at
>>     >
>> https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/exotic.c
>>     >
>>     >     They fit in perfectly while implementing a sax based importer
>>    or a
>>     >     stream based exporter.
>>     >
>>     >     If you have any specific questions don't hesitate to contact
>>    me, i'm
>>     >     happy to support you.
>>     >
>>     >     Sebastian
>>     >
>>     >
>>     >     Chingiz Dyussenov wrote:
>>     >      > Thanks, Sebastian.
>>     >      >
>>     >      > I am interested. I was just going to start coding, so
>>    switching to
>>     >      > OpenCollada is ok. I'll use Ogre example to learn how to do
>>     >     things with
>>     >      > OpenCollada. If there are other free examples, please share.
>>     >      >
>>     >      > Chingiz
>>     >      >
>>     >      >
>>     >      >
>>     >
>>  ------------------------------------------------------------------------
>>     >      >
>>     >      > _______________________________________________
>>     >      > Soc-2009-dev mailing list
>>     >      > Soc-2009-dev at blender.org <mailto:Soc-2009-dev at blender.org>
>>    <mailto:Soc-2009-dev at blender.org <mailto:Soc-2009-dev at blender.org>>
>>     >      > http://lists.blender.org/mailman/listinfo/soc-2009-dev
>>     >     _______________________________________________
>>     >     Soc-2009-dev mailing list
>>     >     Soc-2009-dev at blender.org <mailto:Soc-2009-dev at blender.org>
>>    <mailto:Soc-2009-dev at blender.org <mailto:Soc-2009-dev at blender.org>>
>>     >     http://lists.blender.org/mailman/listinfo/soc-2009-dev
>>     >
>>     >
>>     >
>>     >
>>
>>  ------------------------------------------------------------------------
>>     >
>>     > _______________________________________________
>>     > Soc-2009-dev mailing list
>>     > Soc-2009-dev at blender.org <mailto:Soc-2009-dev at blender.org>
>>     > http://lists.blender.org/mailman/listinfo/soc-2009-dev
>>    _______________________________________________
>>    Soc-2009-dev mailing list
>>    Soc-2009-dev at blender.org <mailto:Soc-2009-dev at blender.org>
>>    http://lists.blender.org/mailman/listinfo/soc-2009-dev
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Soc-2009-dev mailing list
>> Soc-2009-dev at blender.org
>> http://lists.blender.org/mailman/listinfo/soc-2009-dev
>>
>
> Index: include/COLLADASWConstants.h
> ===================================================================
> --- include/COLLADASWConstants.h        (revision 587)
> +++ include/COLLADASWConstants.h        (working copy)
> @@ -46,7 +46,8 @@
>         static const String CSW_ELEMENT_BLINN;
>         static const String CSW_ELEMENT_BIND;
>         static const String CSW_ELEMENT_BIND_MATERIAL;
> -        static const String CSW_ELEMENT_BIND_SHAPE_MATRIX;
> +               static const String CSW_ELEMENT_BIND_SHAPE_MATRIX;
> +               static const String CSW_ELEMENT_BIND_VERTEX_INPUT;
>         static const String CSW_ELEMENT_BORDER_COLOR;
>         static const String CSW_ELEMENT_CAMERA;
>         static const String CSW_ELEMENT_CAMERA_ORTHOGRAPHIC;
> @@ -219,7 +220,9 @@
>         static const String CSW_ATTRIBUTE_END;
>         static const String CSW_ATTRIBUTE_FACE;
>         static const String CSW_ATTRIBUTE_ID;
> -        static const String CSW_ATTRIBUTE_INDEX;
> +               static const String CSW_ATTRIBUTE_INDEX;
> +               static const String CSW_ATTRIBUTE_INPUT_SEMANTIC;
> +               static const String CSW_ATTRIBUTE_INPUT_SET;
>         static const String CSW_ATTRIBUTE_MATERIAL;
>         static const String CSW_ATTRIBUTE_METER;
>         static const String CSW_ATTRIBUTE_METHOD;
> Index: include/COLLADASWInstanceMaterial.h
> ===================================================================
> --- include/COLLADASWInstanceMaterial.h (revision 587)
> +++ include/COLLADASWInstanceMaterial.h (working copy)
> @@ -22,14 +22,61 @@
>  namespace COLLADASW
>  {
>
> +    class BindVertexInput
> +       {
> +       private:
> +               /** Which effect parameter to bind. Required.*/
> +               String mSemantic;
> +
> +               /** Which input semantic to bind. Required.*/
> +               String mInputSemantic;
> +
> +               /** Which input set to bind. Optional. -1 if not set.*/
> +               int mInputSet;
> +       public:
> +
> +               BindVertexInput(const COLLADASW::String& semantic, const
> COLLADASW::String& inputSemantic, int inputSet = -1)
> +                       : mSemantic(semantic),
> mInputSemantic(inputSemantic), mInputSet(inputSet){}
> +
> +               /** Which effect parameter to bind. Required.*/
> +               const COLLADASW::String& getSemantic() const { return
> mSemantic; }
> +
> +               /** Which effect parameter to bind. Required.*/
> +               void setSemantic(const COLLADASW::String& semantic) {
> mSemantic = semantic; }
> +
> +               /** Which input semantic to bind. Required.*/
> +               const COLLADASW::String& getInputSemantic() const { return
> mInputSemantic; }
> +
> +               /** Which input semantic to bind. Required.*/
> +               void setInputSemantic(const COLLADASW::String&
> inputSemantic) { mInputSemantic = inputSemantic; }
> +
> +               /** Which input set to bind. Optional. -1 if not set.*/
> +               int getInputSet() const { return mInputSet; }
> +
> +               /** Which input set to bind. Optional. -1 if not set.*/
> +               void setInputSet(int inputSet) { mInputSet = inputSet; }
> +
> +       private:
> +               /** Set this class a friend, so it can call the add()
> method.  */
> +               friend class InstanceMaterial;
> +
> +               /** Add all the instance materials, added using
> push_back(), to the stream*/
> +               void add( StreamWriter* sw);
> +
> +       };
> +
> +
>     class InstanceMaterialList;
>
>     /** A class that holds informations of an @a \<instance_material\>
> element*/
>     class InstanceMaterial
>     {
> -
> +       private:
> +               /** List of all the BindVertexInput*/
> +               typedef std::list<BindVertexInput> BindVertexInputList;
>     private:
>
> +               BindVertexInputList mBindVertexInputList;
>         String mSymbol;
>         URI mTarget;
>
> @@ -43,17 +90,22 @@
>         : mSymbol ( symbol ), mTarget ( target ) {}
>
>         /** Returns the symbol*/
> -        const String & getSymbol() const
> -        {
> -            return mSymbol;
> -        }
> +        const String & getSymbol() const {return mSymbol; }
>
>         /** Returns the target*/
> -        const URI & getTarget() const
> -        {
> -            return mTarget;
> -        }
> +        const URI & getTarget() const { return mTarget; }
>
> +               /** Adds @a input to list of inputs that should be added*/
> +               void push_back ( const BindVertexInput& input ) {
> mBindVertexInputList.push_back ( input ); }
> +
> +       private:
> +               /** Set this class a friend, so it can call the add()
> method.  */
> +               friend class InstanceMaterialList;
> +
> +               /** Add all the instance materials, added using
> push_back(), to the stream*/
> +               void add( StreamWriter* sw);
> +
> +
>     };
>
>     /** A class that hold a list of instances of InstanceMaterial and
> writes it to stream*/
> @@ -70,16 +122,10 @@
>         virtual ~InstanceMaterialList() {}
>
>         /** Adds @a input to list of inputs that should be added*/
> -        void push_back ( InstanceMaterial input )
> -        {
> -            mList.push_back ( input );
> -        }
> +        void push_back ( const InstanceMaterial& input ) { mList.push_back
> ( input ); }
>
>         /** Return true, if the list of material bindings is empty, false
> otherwise*/
> -        bool empty() const
> -        {
> -            return mList.empty();
> -        }
> +        bool empty() const { return mList.empty(); }
>
>     private:
>
> Index: src/COLLADASWConstants.cpp
> ===================================================================
> --- src/COLLADASWConstants.cpp  (revision 587)
> +++ src/COLLADASWConstants.cpp  (working copy)
> @@ -38,7 +38,8 @@
>     const String CSWC::CSW_ELEMENT_BLINN = "blinn";
>     const String CSWC::CSW_ELEMENT_BIND = "bind";
>     const String CSWC::CSW_ELEMENT_BIND_MATERIAL = "bind_material";
> -    const String CSWC::CSW_ELEMENT_BIND_SHAPE_MATRIX =
> "bind_shape_matrix";
> +       const String CSWC::CSW_ELEMENT_BIND_SHAPE_MATRIX =
> "bind_shape_matrix";
> +       const String CSWC::CSW_ELEMENT_BIND_VERTEX_INPUT =
> "bind_vertex_input";
>     const String CSWC::CSW_ELEMENT_BORDER_COLOR = "border_color";
>     const String CSWC::CSW_ELEMENT_CAMERA = "camera";
>     const String CSWC::CSW_ELEMENT_CAMERA_ORTHOGRAPHIC = "orthographic";
> @@ -209,7 +210,9 @@
>     const String CSWC::CSW_ATTRIBUTE_END = "end";
>     const String CSWC::CSW_ATTRIBUTE_FACE = "face";
>     const String CSWC::CSW_ATTRIBUTE_ID = "id";
> -    const String CSWC::CSW_ATTRIBUTE_INDEX = "index";
> +       const String CSWC::CSW_ATTRIBUTE_INDEX = "index";
> +       const String CSWC::CSW_ATTRIBUTE_INPUT_SEMANTIC = "input_semantic";
> +       const String CSWC::CSW_ATTRIBUTE_INPUT_SET = "input_set";
>     const String CSWC::CSW_ATTRIBUTE_MATERIAL = "material";
>     const String CSWC::CSW_ATTRIBUTE_METER = "meter";
>     const String CSWC::CSW_ATTRIBUTE_METHOD = "method";
> Index: src/COLLADASWInstanceMaterial.cpp
> ===================================================================
> --- src/COLLADASWInstanceMaterial.cpp   (revision 587)
> +++ src/COLLADASWInstanceMaterial.cpp   (working copy)
> @@ -19,11 +19,32 @@
>     {
>         for ( List::iterator it = mList.begin(); it != mList.end(); ++it )
>         {
> -            mSW->openElement ( CSWC::CSW_ELEMENT_INSTANCE_MATERIAL );
> -            mSW->appendAttribute ( CSWC::CSW_ATTRIBUTE_SYMBOL,
> it->getSymbol() );
> -            mSW->appendURIAttribute ( CSWC::CSW_ATTRIBUTE_TARGET,
> it->getTarget() );
> -            mSW->closeElement();
> +                       it->add( mSW );
>         }
>     }
>
> +
> +       //---------------------------------------------------------------
> +       void InstanceMaterial::add( StreamWriter* sw )
> +       {
> +               sw->openElement ( CSWC::CSW_ELEMENT_INSTANCE_MATERIAL );
> +               sw->appendAttribute ( CSWC::CSW_ATTRIBUTE_SYMBOL,
> getSymbol() );
> +               sw->appendURIAttribute ( CSWC::CSW_ATTRIBUTE_TARGET,
> getTarget() );
> +               for ( BindVertexInputList::iterator it =
> mBindVertexInputList.begin(); it != mBindVertexInputList.end(); ++it)
> +               {
> +                       it->add( sw );
> +               }
> +
> +               sw->closeElement();
> +       }
> +
> +       //---------------------------------------------------------------
> +       void BindVertexInput::add( StreamWriter* sw )
> +       {
> +               sw->openElement ( CSWC::CSW_ELEMENT_INSTANCE_MATERIAL );
> +               sw->appendAttribute ( CSWC::CSW_ATTRIBUTE_SEMANTIC,
> getSemantic() );
> +               sw->appendAttribute ( CSWC::CSW_ATTRIBUTE_INPUT_SEMANTIC,
> getInputSemantic() );
> +               sw->appendAttribute ( CSWC::CSW_ATTRIBUTE_INPUT_SET,
> getInputSet() );
> +               sw->closeElement();
> +       }
>  } //namespace COLLADASW
>
> _______________________________________________
> Soc-2009-dev mailing list
> Soc-2009-dev at blender.org
> http://lists.blender.org/mailman/listinfo/soc-2009-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/soc-2009-dev/attachments/20090615/48c0f598/attachment-0001.htm 


More information about the Soc-2009-dev mailing list