ParallelGraphics Forums
SDK
You are here: [Forums]::[General]::[SDK]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
Try RobinZone!
email:  password:
   General - SDK

Subject: MFVec3f.Add Method
Sender: mutafchiev@gmx.de 13.06.07 13:31

Hi there,
I create "IndexedFaceSet" Node with CreateNode().
I take the field "coord" and I put some "Coordinate" Node
with put_Value(Coordinate). I create this "Coordinate" Node
with CreateNodeFromString. It works but this is not what I want. My task is to create "Coordinate" Node with CreateNode(), to take its field "point" as IMFVec3fObject and to fill it with values using MFVec3f.Add Method. The values are for example: point [2 0 -2, 2 0 2, -2 0 2]
I tried it, I don't become any error message but I don'see the
object wich I created this way:

VARIANT before;
before.vt = VT_ERROR;
before.scode = DISP_E_PARAMNOTFOUND;
int x, y, z;

for(int i=0; i<coordPoints.size(); ){
        x = coordPoints[i];
        ++i;
        y = coordPoints[i];
        ++i;
        z = coordPoints[i];
        ++i;
        
    // copied from the forum
    // Create the safe array
    const int iCount = 3;
    SAFEARRAYBOUND sSABound[1];
    SAFEARRAY *pSA;

    sSABound[0].cElements = iCount;
    sSABound[0].lLbound = 0;
    pSA = SafeArrayCreate(VT_VARIANT, 1,
        sSABound);

    // Gain access to the values
    VARIANT *pVal = NULL;
    HRESULT hResult = SafeArrayAccessData(pSA,
(void**)&pVal);    
    if (SUCCEEDED(hResult)) {
        // Populate the array
        VariantInit(pVal);
        pVal[0].vt = VT_R4;
        pVal[0].intVal = x;
        VariantInit(pVal + 1);
        pVal[0].vt = VT_R4;
        pVal[0].intVal = y;
        VariantInit(pVal + 2);
        pVal[0].vt = VT_R4;
        pVal[0].intVal = z;        
        SafeArrayUnaccessData(pSA);
    }
    else {
        SafeArrayDestroy(pSA);
        return false;
    }

    // Initialise the variant
    VARIANT sVariant;
    VariantInit(&sVariant);

    // Set the type and value
    sVariant.vt = VT_ARRAY | VT_VARIANT;
    sVariant.parray = pSA;
    
    if(SUCCEEDED(m_IMFVec3fObject->Add(&sVariant,
&before)))
        AfxMessageBox(L"Add Variant Vector OK");
    
    }

Do you see something wrong in this code?
I am glad for any suggestions.

Regards

Stoyan

 


MFVec3f.Add Method / mutafchiev@gmx.de / 13.06.07 13:31

Messages in thread: 1


© 1998-2007 ParallelGraphics. All rights reserved. Terms of use.