Inheritance diagram for I3DShExternalPrimitive:

Public Member Functions | |
| virtual MCCOMErr MCCOMAPI | SetPrimitiveComponent (IShComponent *primitiveComponent, ECloneMode cloneMode)=0 |
| virtual MCCOMErr MCCOMAPI | GetPrimitiveComponent (IShComponent **primitiveComponent)=0 |
| virtual I3DShPrimitive *MCCOMAPI | GetPrimitive ()=0 |
Primitive is one particular type of Master Objects (see I3DShObject). They can be instantianted multiple times.
There are 2 COM objects to consider:
For advanced users: You should note that there are actually 3 C++ object (The primitive, the primitive component and the primitive light). However the primitive component and the external primitive are aggregated by COM which means that you can be considered as one single COM object).
To get a pointer to a I3DShExternalPrimitive from a I3DExGeometricPrimitive, you can use the following code:
TMCCountedPtr<I3DShPrimitiveComponent> primitiveComponent; exPrimitive->QueryInterface(IID_I3DShPrimitiveComponent,(void**)&primitiveComponent); ThrowIfNil(primitiveComponent); TMCCountedPtr<I3DShPrimitive> primitive; primitiveComponent->GetPrimitive(&primitive); ThrowIfNil(primitive); TMCCountedPtr<I3DShExternalPrimitive> externalPrimitive; primitive->QueryInterface(IID_I3DShExternalPrimitive.(void**)&externalPrimitive);
To access I3DExGeometricPrimitive from I3DShPrimitive, you can use the following code:
TMCCountedPtr<I3DShExternalPrimitive> externalPrimitive; shPrimitive->QueryInterface(IID_I3DShExternalPrimitive.(void**)&externalPrimitive); ThrowIfNil(externalPrimitive); TMCCountedPtr<IShComponent> primitiveComponent; externalPrimitive->GetPrimitiveComponent(&primitiveComponent); ThrowIfNil(primitiveComponent); TMCCountedPtr<I3DExGeometricPrimitive> externalPrimitive; primitiveComponent->QueryInterface(IID_I3DExGeometricPrimitive,(void**)&externalPrimitive);
This code might seem a bit complicated at first but it is actually simple. You have two COM objects that point on each other. I3DShExternalPrimitive::GetPrimitiveComponent() and I3DShPrimitiveComponent::GetPrimitive() allow you to get a pointer from one object to the other. The rest is only calling QueryInterface to get the right interface on each object.
|
|
Returns a pointer to the primitive interface. (This is a bit faster than using QueryInterface). |
|
|
Returns a pointer to the primitive component associated with this primitive.
|
|
||||||||||||
|
Sets the primitive component associated with this primitive.
|
1.3.9.1