1 /*************************************************************************/
2 /*  editor_preview_plugins.h                                             */
3 /*************************************************************************/
4 /*                       This file is part of:                           */
5 /*                           GODOT ENGINE                                */
6 /*                      https://godotengine.org                          */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur.                 */
9 /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md)    */
10 /*                                                                       */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the       */
13 /* "Software"), to deal in the Software without restriction, including   */
14 /* without limitation the rights to use, copy, modify, merge, publish,   */
15 /* distribute, sublicense, and/or sell copies of the Software, and to    */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions:                                             */
18 /*                                                                       */
19 /* The above copyright notice and this permission notice shall be        */
20 /* included in all copies or substantial portions of the Software.       */
21 /*                                                                       */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
29 /*************************************************************************/
30 #ifndef EDITORPREVIEWPLUGINS_H
31 #define EDITORPREVIEWPLUGINS_H
32 
33 #include "editor/editor_resource_preview.h"
34 
35 class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator {
36 public:
37 	virtual bool handles(const String &p_type) const;
38 	virtual Ref<Texture> generate(const RES &p_from);
39 
40 	EditorTexturePreviewPlugin();
41 };
42 
43 class EditorBitmapPreviewPlugin : public EditorResourcePreviewGenerator {
44 public:
45 	virtual bool handles(const String &p_type) const;
46 	virtual Ref<Texture> generate(const RES &p_from);
47 
48 	EditorBitmapPreviewPlugin();
49 };
50 
51 class EditorPackedScenePreviewPlugin : public EditorResourcePreviewGenerator {
52 
53 	Ref<Texture> _gen_from_imd(Ref<ResourceImportMetadata> p_imd);
54 
55 public:
56 	virtual bool handles(const String &p_type) const;
57 	virtual Ref<Texture> generate(const RES &p_from);
58 	virtual Ref<Texture> generate_from_path(const String &p_path);
59 
60 	EditorPackedScenePreviewPlugin();
61 };
62 
63 class EditorMaterialPreviewPlugin : public EditorResourcePreviewGenerator {
64 
65 	RID scenario;
66 	RID sphere;
67 	RID sphere_instance;
68 	RID viewport;
69 	RID light;
70 	RID light_instance;
71 	RID light2;
72 	RID light_instance2;
73 	RID camera;
74 
75 public:
76 	virtual bool handles(const String &p_type) const;
77 	virtual Ref<Texture> generate(const RES &p_from);
78 
79 	EditorMaterialPreviewPlugin();
80 	~EditorMaterialPreviewPlugin();
81 };
82 
83 class EditorScriptPreviewPlugin : public EditorResourcePreviewGenerator {
84 public:
85 	virtual bool handles(const String &p_type) const;
86 	virtual Ref<Texture> generate(const RES &p_from);
87 
88 	EditorScriptPreviewPlugin();
89 };
90 
91 class EditorSamplePreviewPlugin : public EditorResourcePreviewGenerator {
92 public:
93 	virtual bool handles(const String &p_type) const;
94 	virtual Ref<Texture> generate(const RES &p_from);
95 
96 	EditorSamplePreviewPlugin();
97 };
98 
99 class EditorMeshPreviewPlugin : public EditorResourcePreviewGenerator {
100 
101 	RID scenario;
102 	RID mesh_instance;
103 	RID viewport;
104 	RID light;
105 	RID light_instance;
106 	RID light2;
107 	RID light_instance2;
108 	RID camera;
109 
110 public:
111 	virtual bool handles(const String &p_type) const;
112 	virtual Ref<Texture> generate(const RES &p_from);
113 
114 	EditorMeshPreviewPlugin();
115 	~EditorMeshPreviewPlugin();
116 };
117 
118 #endif // EDITORPREVIEWPLUGINS_H
119