Exemplo n.º 1
0
void cBillboard::UpdateGraphics(cCamera3D *apCamera,float afFrameTime, cRenderList *apRenderList)
{
    if(mbIsHalo==false) return;

    ////////////////////////
    //Set the alpha
    float fAlpha = 0;

    if(mlLastRenderCount == apRenderList->GetLastRenderCount())
        {
            if(mMaxQueryObject.mpQuery->GetSampleCount()>0)
                {
                    fAlpha =	(float)mQueryObject.mpQuery->GetSampleCount() /
                                (float)mMaxQueryObject.mpQuery->GetSampleCount();
                }
        }
    SetHaloAlpha(fAlpha);
    mlLastRenderCount = apRenderList->GetRenderCount();

    ////////////////////////
    //Add the queries
    if(mbHaloSourceIsParent)
        {
            iRenderable *pParent = static_cast<iRenderable*>(GetEntityParent());
            if(pParent==NULL)
                {
                    Error("Billboard %s has no parent!\n",msName.c_str());
                    return;
                }

            iVertexBuffer *pVtxBuffer = pParent->GetVertexBuffer();
            if(pVtxBuffer==NULL)
                {
                    Error("Billboard '%s' parent '%s' as NULL vertex buffer!\n",msName.c_str(),
                          pParent->GetName().c_str());
                    return;
                }

            mQueryObject.mpMatrix = pParent->GetModelMatrix(apCamera);
            mQueryObject.mpVtxBuffer = pVtxBuffer;

            mMaxQueryObject.mpMatrix = pParent->GetModelMatrix(apCamera);
            mMaxQueryObject.mpVtxBuffer = pVtxBuffer;
        }
    else
        {
            mQueryObject.mpMatrix = &GetWorldMatrix();
            mQueryObject.mpVtxBuffer = mpHaloSourceBuffer;

            mMaxQueryObject.mpMatrix = &GetWorldMatrix();
            mMaxQueryObject.mpVtxBuffer = mpHaloSourceBuffer;
        }

    mQueryObject.mbDepthTest = true;
    mMaxQueryObject.mbDepthTest = false;

    apRenderList->AddOcclusionQuery(&mQueryObject);
    apRenderList->AddOcclusionQuery(&mMaxQueryObject);

}
Exemplo n.º 2
0
EntityID dd::World::GetEntityBaseParent(EntityID entity)
{
	EntityID parent = GetEntityParent(entity);
	if (parent == 0)
		return entity;
	else
		return GetEntityBaseParent(parent);
}