Irrlicht 3D Engine
IGPUProgrammingServices.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2012 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
00006 #define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
00007 
00008 #include "EShaderTypes.h"
00009 #include "EMaterialTypes.h"
00010 #include "EPrimitiveTypes.h"
00011 #include "path.h"
00012 
00013 namespace irr
00014 {
00015 
00016 namespace io
00017 {
00018     class IReadFile;
00019 } // end namespace io
00020 
00021 namespace video
00022 {
00023 
00024 class IVideoDriver;
00025 class IShaderConstantSetCallBack;
00026 
00028 enum E_GPU_SHADING_LANGUAGE
00029 {
00031     EGSL_DEFAULT = 0,
00032 
00034     EGSL_CG
00035 };
00036 
00038 class IGPUProgrammingServices
00039 {
00040 public:
00041 
00043     virtual ~IGPUProgrammingServices() {}
00044 
00046 
00087     virtual s32 addHighLevelShaderMaterial(
00088         const c8* vertexShaderProgram,
00089         const c8* vertexShaderEntryPointName,
00090         E_VERTEX_SHADER_TYPE vsCompileTarget,
00091         const c8* pixelShaderProgram,
00092         const c8* pixelShaderEntryPointName,
00093         E_PIXEL_SHADER_TYPE psCompileTarget,
00094         const c8* geometryShaderProgram,
00095         const c8* geometryShaderEntryPointName = "main",
00096         E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
00097         scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
00098         scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
00099         u32 verticesOut = 0,
00100         IShaderConstantSetCallBack* callback = 0,
00101         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00102         s32 userData = 0,
00103         E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
00104 
00106     s32 addHighLevelShaderMaterial(
00107         const c8* vertexShaderProgram,
00108         const c8* vertexShaderEntryPointName="main",
00109         E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1,
00110         const c8* pixelShaderProgram=0,
00111         const c8* pixelShaderEntryPointName="main",
00112         E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1,
00113         IShaderConstantSetCallBack* callback=0,
00114         E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID,
00115         s32 userData=0,
00116         E_GPU_SHADING_LANGUAGE shadingLang=EGSL_DEFAULT)
00117     {
00118         return addHighLevelShaderMaterial(
00119             vertexShaderProgram, vertexShaderEntryPointName,
00120             vsCompileTarget, pixelShaderProgram,
00121             pixelShaderEntryPointName, psCompileTarget,
00122             0, "main", EGST_GS_4_0,
00123             scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
00124             callback, baseMaterial, userData, shadingLang);
00125     }
00126 
00128 
00131     s32 addHighLevelShaderMaterial(
00132         const c8* vertexShaderProgram,
00133         const c8* pixelShaderProgram=0,
00134         IShaderConstantSetCallBack* callback=0,
00135         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00136         s32 userData=0)
00137     {
00138         return addHighLevelShaderMaterial(
00139             vertexShaderProgram, "main",
00140             EVST_VS_1_1, pixelShaderProgram,
00141             "main", EPST_PS_1_1,
00142             0, "main", EGST_GS_4_0,
00143             scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
00144             callback, baseMaterial, userData);
00145     }
00146 
00148 
00151     s32 addHighLevelShaderMaterial(
00152         const c8* vertexShaderProgram,
00153         const c8* pixelShaderProgram = 0,
00154         const c8* geometryShaderProgram = 0,
00155         scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
00156         scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
00157         u32 verticesOut = 0,
00158         IShaderConstantSetCallBack* callback = 0,
00159         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00160         s32 userData = 0 )
00161     {
00162         return addHighLevelShaderMaterial(
00163             vertexShaderProgram, "main",
00164             EVST_VS_1_1, pixelShaderProgram,
00165             "main", EPST_PS_1_1,
00166             geometryShaderProgram, "main", EGST_GS_4_0,
00167             inType, outType, verticesOut,
00168             callback, baseMaterial, userData);
00169     }
00170 
00172 
00214     virtual s32 addHighLevelShaderMaterialFromFiles(
00215         const io::path& vertexShaderProgramFileName,
00216         const c8* vertexShaderEntryPointName,
00217         E_VERTEX_SHADER_TYPE vsCompileTarget,
00218         const io::path& pixelShaderProgramFileName,
00219         const c8* pixelShaderEntryPointName,
00220         E_PIXEL_SHADER_TYPE psCompileTarget,
00221         const io::path& geometryShaderProgramFileName,
00222         const c8* geometryShaderEntryPointName = "main",
00223         E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
00224         scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
00225         scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
00226         u32 verticesOut = 0,
00227         IShaderConstantSetCallBack* callback = 0,
00228         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00229         s32 userData = 0,
00230         E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
00231 
00233     s32 addHighLevelShaderMaterialFromFiles(
00234         const io::path& vertexShaderProgramFileName,
00235         const c8* vertexShaderEntryPointName = "main",
00236         E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
00237         const io::path& pixelShaderProgramFileName = "",
00238         const c8* pixelShaderEntryPointName = "main",
00239         E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
00240         IShaderConstantSetCallBack* callback = 0,
00241         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00242         s32 userData = 0,
00243         E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT)
00244     {
00245         return addHighLevelShaderMaterialFromFiles(
00246             vertexShaderProgramFileName, vertexShaderEntryPointName,
00247             vsCompileTarget, pixelShaderProgramFileName,
00248             pixelShaderEntryPointName, psCompileTarget,
00249             "", "main", EGST_GS_4_0,
00250             scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
00251             callback, baseMaterial, userData, shadingLang);
00252     }
00253 
00255 
00258     s32 addHighLevelShaderMaterialFromFiles(
00259         const io::path& vertexShaderProgramFileName,
00260         const io::path& pixelShaderProgramFileName = "",
00261         IShaderConstantSetCallBack* callback = 0,
00262         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00263         s32 userData = 0 )
00264     {
00265         return addHighLevelShaderMaterialFromFiles(
00266             vertexShaderProgramFileName, "main",
00267             EVST_VS_1_1, pixelShaderProgramFileName,
00268             "main", EPST_PS_1_1,
00269             "", "main", EGST_GS_4_0,
00270             scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
00271             callback, baseMaterial, userData);
00272     }
00273 
00275 
00278     s32 addHighLevelShaderMaterialFromFiles(
00279         const io::path& vertexShaderProgramFileName,
00280         const io::path& pixelShaderProgramFileName = "",
00281         const io::path& geometryShaderProgramFileName = "",
00282         scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
00283         scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
00284         u32 verticesOut = 0,
00285         IShaderConstantSetCallBack* callback = 0,
00286         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00287         s32 userData = 0 )
00288     {
00289         return addHighLevelShaderMaterialFromFiles(
00290             vertexShaderProgramFileName, "main",
00291             EVST_VS_1_1, pixelShaderProgramFileName,
00292             "main", EPST_PS_1_1,
00293             geometryShaderProgramFileName, "main", EGST_GS_4_0,
00294             inType, outType, verticesOut,
00295             callback, baseMaterial, userData);
00296     }
00297 
00299 
00339     virtual s32 addHighLevelShaderMaterialFromFiles(
00340         io::IReadFile* vertexShaderProgram,
00341         const c8* vertexShaderEntryPointName,
00342         E_VERTEX_SHADER_TYPE vsCompileTarget,
00343         io::IReadFile* pixelShaderProgram,
00344         const c8* pixelShaderEntryPointName,
00345         E_PIXEL_SHADER_TYPE psCompileTarget,
00346         io::IReadFile* geometryShaderProgram,
00347         const c8* geometryShaderEntryPointName = "main",
00348         E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
00349         scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
00350         scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
00351         u32 verticesOut = 0,
00352         IShaderConstantSetCallBack* callback = 0,
00353         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00354         s32 userData = 0,
00355         E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
00356 
00358     s32 addHighLevelShaderMaterialFromFiles(
00359         io::IReadFile* vertexShaderProgram,
00360         const c8* vertexShaderEntryPointName = "main",
00361         E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
00362         io::IReadFile* pixelShaderProgram = 0,
00363         const c8* pixelShaderEntryPointName = "main",
00364         E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
00365         IShaderConstantSetCallBack* callback = 0,
00366         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00367         s32 userData = 0,
00368         E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT)
00369     {
00370         return addHighLevelShaderMaterialFromFiles(
00371             vertexShaderProgram, vertexShaderEntryPointName,
00372             vsCompileTarget, pixelShaderProgram,
00373             pixelShaderEntryPointName, psCompileTarget,
00374             0, "main", EGST_GS_4_0,
00375             scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
00376             callback, baseMaterial, userData, shadingLang);
00377     }
00378 
00380 
00413     virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
00414         const c8* pixelShaderProgram = 0,
00415         IShaderConstantSetCallBack* callback = 0,
00416         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00417         s32 userData = 0) = 0;
00418 
00420 
00437     virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
00438         io::IReadFile* pixelShaderProgram,
00439         IShaderConstantSetCallBack* callback = 0,
00440         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00441         s32 userData = 0) = 0;
00442 
00444 
00462     virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
00463         const io::path& pixelShaderProgramFileName,
00464         IShaderConstantSetCallBack* callback = 0,
00465         E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
00466         s32 userData = 0) = 0;
00467 };
00468 
00469 
00470 } // end namespace video
00471 } // end namespace irr
00472 
00473 #endif
00474