Ejemplo n.º 1
0
int newmesh(lua_State *L, scene_t *scene, mesh_t *mesh)
    {
    unsigned int i;
    ud_t *ud;
    TRACE_CREATE(mesh, "mesh");
    if(mesh->mFaces != NULL && mesh->mNumFaces > 0)
        {
        for(i = 0; i < mesh->mNumFaces; i++)
            { newface(L, scene, mesh, &(mesh->mFaces[i])); lua_pop(L, 1); }
        TRACE_CREATE_N(i, "faces");
        }
    if(mesh->mBones != NULL && mesh->mNumBones > 0)
        {
        for(i = 0; i < mesh->mNumBones; i++)
            { newbone(L, scene, mesh, mesh->mBones[i]); lua_pop(L, 1); }
        TRACE_CREATE_N(i, "bones");
        }
    if(mesh->mAnimMeshes != NULL && mesh->mNumAnimMeshes > 0)
        {
        for(i = 0; i < mesh->mNumAnimMeshes; i++)
            { newanimmesh(L, scene, mesh, mesh->mAnimMeshes[i]); lua_pop(L, 1); }
        TRACE_CREATE_N(i, "animmeshes");
        }
    ud = newuserdata(L, (void*)mesh, MESH_MT);
    ud->scene = scene;
    return 1;   
    }
Ejemplo n.º 2
0
// ---------------------------------------------------------------------------
// Constructor
// ---------------------------------------------------------------------------
CAudioGainControl::CAudioGainControl()
	{
	TRACE_CREATE();
	DP_CONTEXT(CAudioGainControl::CAudioGainControl *CD1*, CtxDevSound, DPLOCAL);
	DP_IN();
	DP_OUT();
	}
Ejemplo n.º 3
0
int newmaterial(lua_State *L, scene_t *scene, material_t *material)
    {
    ud_t *ud;
    TRACE_CREATE(material, "material");
    ud = newuserdata(L, (void*)material, MATERIAL_MT);
    ud->scene = scene;
    return 1;   
    }
Ejemplo n.º 4
0
// ---------------------------------------------------------------------------
// Constructor
// ---------------------------------------------------------------------------
//
CBufferSource::CBufferSource()
	: CActive(EPriorityStandard)
	{
	TRACE_CREATE();
	DP_CONTEXT(CBufferSource::CBufferSource *CD1*, CtxDevSound, DPLOCAL);
	DP_IN();
	DP_OUT();
	}
// -----------------------------------------------------------------------------
// CMMFDevSoundAdaptation::CMMFDevSoundAdaptation
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CMMFDevSoundAdaptation::CMMFDevSoundAdaptation()
	{
	TRACE_CREATE();
	DP_CONTEXT(CMMFDevSoundAdaptation::CMMFDevSoundAdaptation *CD1*, CtxDevSound, DPLOCAL);
	DP_IN();
	PRF_HEAP_STATUS(PRF_MEM, HEAP_DS_Session);
	DP_OUT();
	}
void D3DeviceFactory::initDirect3D() { // static
  Direct3DCreate9Ex( D3D_SDK_VERSION, &s_direct3D);
  if(s_direct3D == NULL) {
    const TCHAR *msg = _T("Cannot initialize Direct3D");
    showError(msg);
    throwException(_T("%s"), msg);
  }
  TRACE_CREATE(s_direct3D);
}
Ejemplo n.º 7
0
int newanimation(lua_State *L, scene_t *scene, animation_t *animation)
    {
    unsigned int i;
    ud_t *ud;
    TRACE_CREATE(animation, "animation");
    if(animation->mChannels != NULL && animation->mNumChannels > 0)
        {
        for(i = 0; i < animation->mNumChannels; i++)
            { newnodeanim(L, scene, animation, animation->mChannels[i]); lua_pop(L, 1); }
        TRACE_CREATE_N(i, "nodeanims");
        }
    if(animation->mMeshChannels != NULL && animation->mNumMeshChannels > 0)
        {
        for(i = 0; i < animation->mNumMeshChannels; i++)
            { newmeshanim(L, scene, animation, animation->mMeshChannels[i]); lua_pop(L, 1); }
        TRACE_CREATE_N(i, "meshanims");
        }
    ud = newuserdata(L, (void*)animation, ANIMATION_MT);
    ud->scene = scene;
    return 1;   
    }
LPDIRECT3DDEVICE D3DeviceFactory::createDevice(HWND hwnd, D3DPRESENT_PARAMETERS *param, UINT adapter) { // static
  if(s_direct3D == NULL) {
    initDirect3D();
  }

  D3DPRESENT_PARAMETERS tmpParam;
  if(param == NULL) {
    tmpParam = getDefaultPresentParameters(hwnd, adapter);
    param = &tmpParam;
  }
  LPDIRECT3DDEVICE device;

  CHECKRESULT(s_direct3D->CreateDeviceEx(adapter
                                        ,D3DDEVTYPE_HAL
                                        ,hwnd
                                        ,D3DCREATE_SOFTWARE_VERTEXPROCESSING
                                        ,param
                                        ,NULL
                                        ,&device));
  TRACE_CREATE(device);

  return device;
}
Ejemplo n.º 9
0
int newscene(lua_State *L, scene_t *scene)
/* recursively creates the userdata for the scene,
 * the root node and its children, and all other nested objects */
    {
    unsigned int i;
    TRACE_CREATE(scene, "scene");
    if(scene->mRootNode)
        {
        newnode(L, scene, scene->mRootNode);
        lua_pop(L, 1);
        }
#define New(what, newfunc) do {                     \
    for(i=0; i< scene->mNum##what; i++)             \
        { newfunc(L, scene, scene->m##what[i]); lua_pop(L, 1);  } } while(0)
    New(Meshes, newmesh);
    New(Materials, newmaterial);
    New(Lights, newlight);
    New(Textures, newtexture);
    New(Cameras, newcamera);
    New(Animations, newanimation);
#undef New
    newuserdata(L, (void*)scene, SCENE_MT);
    return 1;   
    }