コード例 #1
0
// シェーダごとの初期化
BOOL CHemiLightShader::InitInternal(izanagi::graph::CGraphicsDevice* pDevice)
{
	UNUSED_ALWAYS(pDevice);
	IZ_ASSERT(m_pEffect != IZ_NULL);

	if (!GetCommonParameterHandles()) {
		return IZ_FALSE;
	}

	static const char* PARAM_NAME[] = {
		"g_vEye",
		"g_vMtrlDiffuse",
		"g_vAxis",
		"g_vUpColor",
		"g_vDownColor",
	};
	C_ASSERT(COUNTOF(PARAM_NAME) == HANDLE_NUM);

	IZ_BOOL result = GetParameterByName(
						HANDLE_NUM,
						m_hHandles,
						PARAM_NAME);
	IZ_ASSERT(result);

	return result;
}
コード例 #2
0
ファイル: Effect.new.cpp プロジェクト: alanzw/JimEngine
Effect::Effect(GraphicsSystem *curSystem, CTSTR lpEffectFile)
{
    traceIn(Effect::Effect);

    system = curSystem;

    String strEffectFile = lpEffectFile;
    strEffectFile.FindReplace(TEXT("\\"), TEXT("/"));
    strEffectDir = GetPathDirectory(strEffectFile);

    effectPath = strEffectFile;

    XFile chi;

    if(!chi.Open(strEffectFile, XFILE_READ, XFILE_OPENEXISTING))
        ErrOut(TEXT("Could not open effect file '%s'"), strEffectFile.Array());

    String strFile;
    chi.ReadFileToString(strFile);
    chi.Close();

    String errors;

    bProcessing = TRUE;
    system->curProcessingEffect = this;

    EffectProcessor test;
    if(!test.ProcessEffect(this, GetPathFileName(strEffectFile, TRUE), strFile, errors))
        ProgramBreak();

    bProcessing = FALSE;
    system->curProcessingEffect = NULL;

    hViewProj = GetParameterByName(TEXT("ViewProj"));
    hWorld = GetParameterByName(TEXT("World"));
    hScale = GetParameterByName(TEXT("World"));

    traceOut;
}