Microsoft SDK for Java

loadFromFileByPos

This method of the Direct3dRM Class loads an object. This method enables you to inspect an X file and decide what object to load, using the ILoadCallback interface.

Syntax

public void loadFromFileByPos(String fnam, int[] id, _Guid g, int cnt, int options, ILoadCallback fn1, int[] arg1, ILoadTextureCallbck fn2, int[] arg2, Direct3dRMFrame f);

The following example shows how this method can be used:

Example

//Indicate what type of objects will be sent to the callback.

IID_IDirect3DRMFrame.set(0xeb16cb03, (short)0xd271,(short) 0x11ce,
 (byte)0xac, (byte)0x48, (byte)0x0,(byte) 0x0,(byte) 0xc0, (byte)0x38,
 (byte)0x25, (byte)0xa1);
IID_IDirect3DRMMeshBuilder.set(0xa3a80d02, (short)0x6e12, (short)0x11cf,
 (byte)0xac, (byte)0x4a, (byte)0x0, (byte)0x0, (byte)0xc0, (byte)0x38,
 (byte)0x25, (byte)0xa1);
IID_IDirect3DRMAnimationSet.set(0xeb16cb0e, (short)0xd271,(short) 0x11ce,
 (byte)0xac, (byte)0x48, (byte)0x0, (byte)0x0, (byte)0xc0, (byte)0x38,
 (byte)0x25, (byte)0xa1);

// If you use 0, you will retrieve all objects.
d3drm.loadFromFileByPos(sFile,
    null, IID_IDirect3DRMFrame, 1,
    D3DRM_LOADFROMFILE, this,
    null, this,
    null, f_env);

public void callbackLoad(Direct3dRMObject obj, _Guid id, IUnknown Arg)
{   
    String sType=obj.getClassName();
    if (sType.equals("Frame"))
    {
         Direct3dRMFrame f=obj.getd3drmFrame();      
         f_env.addChild(f);
    }
    if (sType.equals("Builder"))
    {
         Direct3dRMMeshBuilder m=obj.getd3drmMeshBuilder();
         System.out.println("OK to convert");
         f_env.addVisualMeshBuilder(m);
    }
}
// other callbacks ...

Parameters

fnam The name of the file that the object is loaded from.
id The object position. The value of the first variable in the array gives the object's order in the file.
g The interface identifier to be loaded.
cnt The number of identifiers specified in the g parameter.
options A load options type.
fn1 The callback interface that contains a load callback function called when the system reads the specified object.
arg1 Application-defined data passed to the load callback function.
fn2 The callback interface that contains a load texture callback function called to load any textures used by an object that require special formatting. This parameter can be null.
arg2 Application-defined data passed to the load texture callback function.
f A parent frame. This information is useful when loading Direct3dRMAnimationSet or Direct3dRMFrame objects because otherwise, these objects would be created with a null parent. This value can be null.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.