///////////////////////////////////////////////////// ///////////////////////////////////////////////////// // // IsStretchRectSupported // ///////////////////////////////////////////////////// ///////////////////////////////////////////////////// #include "stdafx.h" #include "CKRasterizer.h" CKERROR CreateIsStretchRectSupportedProto(CKBehaviorPrototype **); int IsStretchRectSupported(const CKBehaviorContext& behcontext); enum { OutParam_StretchRectSupported = 0 }; CKObjectDeclaration *FillBehaviorIsStretchRectSupported() { CKObjectDeclaration *od = CreateCKObjectDeclaration("Is Stretch Rect Supported"); od->SetDescription("Tells wether the Stretch Rect functionnality is supported by the current rasterizer"); od->SetCategory("Shaders/General"); od->SetType(CKDLL_BEHAVIORPROTOTYPE); od->SetGuid(CKGUID(0x558b6423, 0x1a7362eb)); od->SetAuthorGuid(CKGUID()); od->SetAuthorName("Virtools"); od->SetVersion(0x00010000); od->SetCreationFunction(CreateIsStretchRectSupportedProto); return od; } CKERROR CreateIsStretchRectSupportedProto(CKBehaviorPrototype **pproto) { CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("Is Stretch Rect Supported"); if(!proto) return CKERR_OUTOFMEMORY; proto->DeclareInput("In"); proto->DeclareOutput("Yes"); proto->DeclareOutput("No"); proto->DeclareOutParameter("Supported", CKPGUID_BOOL, "TRUE" ); proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL); proto->SetFunction(IsStretchRectSupported); proto->SetBehaviorFlags(CKBEHAVIOR_TARGETABLE); *pproto = proto; return CK_OK; } int IsStretchRectSupported(const CKBehaviorContext& behcontext) { CKBehavior* beh = behcontext.Behavior; beh->ActivateInput(0,FALSE); // CKRasterizerContext* rsctx = behcontext.CurrentRenderContext->GetRasterizerContext(); CKBOOL support = rsctx ? rsctx->m_Driver->m_3DCaps.StretchRectSupport : FALSE; beh->SetOutputParameterValue(OutParam_StretchRectSupported, &support); beh->ActivateOutput(support ? 0 : 1); return CKBR_OK; }