-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjects.cpp
More file actions
53 lines (42 loc) · 919 Bytes
/
objects.cpp
File metadata and controls
53 lines (42 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <fstream>
#include "C3DS.h"
#include "Shader.h"
C3DS scene;
extern void DrawFps();
char TextureFilter;
Shader ModelShader;
// Èçìåíåíèå ðåæèìà ôèëüòðàöèè
void ChangeTextureFilter()
{
++TextureFilter;
TextureFilter%=4;
scene.SetFilterMode(TextureFilter);
}
// Çàãðóçêà îáúåêòîâ.
void LoadObjects(char* filename)
{
string _fnf = ProgPath+"Models\\"+string(filename);
if (!FileExists(_fnf.c_str()))
{
WriteLogF("Scene file does not exists, exiting...");
exit(1);
}
TextureFilter = TEXTURE_FILTER_NEAREST;
// Çàãðóçêà ñöåíû
scene.Load(_fnf.c_str(), &ModelShader);
// Çàãðóçêà øåéäåðîâ
ModelShader.LoadShader("Phong");
}
void RenderObjects()
{
// Ïðèìåíåíèå èñòî÷íèêà ñâåòà
CLight* _light = scene.GetCurrentLight();
if (_light != NULL)
_light->ApplyLight();
// èñïîëüçóåì øåéäåð
ModelShader.Activate();
// Âûâîä îáúåêòîâ
scene.Render();
ModelShader.Deactivate();
DrawFps();
}