-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathComputerRenderQueue.h
153 lines (125 loc) · 5.57 KB
/
ComputerRenderQueue.h
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#include <Ogre.h>
#pragma once
// here we include the header of Magic Library
//#include "OgreMagic.h"
using namespace Ogre;
class MagicRenderQueue:public Ogre::RenderQueueListener
{
private:
// Here we declare our variable
// HSPRITE rastaImage;
// HSPRITE haloImage;
// HSPRITE Surface;
public:
MagicRenderQueue(RenderWindow* mWin, String path)
{
}
// Here we initializing our variable
/*
if(ML_FileExist("MagicMedia.cfg"))
ML_SetMediaDirectoryFromFile("MagicMedia.cfg");
else
ML_SetMediaDirectory((char*)path.c_str());
Surface = ML_CreateSprite(570,100);
ML_StartDrawingToSprite(Surface);
cairo_t* cr = ML_GetCairoCr();
cairo_select_ft_font(cr, ML_GetWindowsPath("fonts/tahomabd.ttf"));
cairo_set_font_size(cr, 90.0);
cairo_move_to(cr, 50, 80);
cairo_text_path(cr, "OgerMagic");
cairo_set_source_rgb(cr, 0, 0, 0);
cairo_fill_preserve(cr);
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_set_line_width(cr, 2.50);
cairo_stroke(cr);
ML_StopDrawingToSprite(Surface);
haloImage = ML_LoadSprite("halo.bmp");
ML_SetColorKeyFromPoint(haloImage,0,0);
rastaImage = ML_CreateSprite(1,64);
ML_StartDrawingToSprite(rastaImage);
cr = ML_GetCairoCr();
cairo_pattern_t *pat = cairo_pattern_create_linear(0,0,0,64);
cairo_pattern_add_color_stop_rgba(pat, 0, 0, 0, 0 ,0);
cairo_pattern_add_color_stop_rgba(pat,0.5, 1, 1, 1 ,1);
cairo_pattern_add_color_stop_rgba(pat, 1, 0, 0, 0 ,0);
cairo_set_source(cr, pat);
cairo_rectangle(cr, 0, 0, 1,64);
cairo_fill(cr);
cairo_pattern_destroy(pat);
ML_StopDrawingToSprite(rastaImage);
}
virtual ~MagicRenderQueue()
{
}
/// Called by Ogre, for being a render queue listener
virtual void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation)
{
// very important
// first check the invocation and queueGroupId parameters
if( queueGroupId == RENDER_QUEUE_OVERLAY && invocation != "SHADOWS")
{
ML_UpdateTimer();
ML_Use2DView();
ML_SetAlpha(1.0);
ML_SetColor(255,255,255);
ML_SetBlendMode(LIGHTBLEND);
static float midWidth = ML_GetScreenWidth()/2.0;
static float midHeight = ML_GetScreenHeight()/2.0;
static float angle=0,angleadd=7,freq=1;
static float angle1=0,angleadd1=5,freq1=1.2;
static float angle2=0,angleadd2=3,freq2=1.65;
static float theta;
if(ML_Every(50))
{
angle +=angleadd;
angle1+=angleadd1;
angle2+=angleadd2;
theta = (theta >= 360-1.5) ? 0 : theta + 0.01;
}
ML_SetScale(1.0,1.7);
ML_SetColor(0,0,255);
float xstart=midWidth-256,ycenter=midHeight,scale=28;
for(float i=0;i<512;i++)
{
float temp = i+xstart;
if(temp>0 || temp<512)
ML_DrawSprite(rastaImage, temp, ycenter + sin((i+angle)*freq*3.141592654/180.0)*scale);
}
ML_SetColor(0,255,0);
xstart=midWidth-256+5,ycenter=midHeight,scale=28;
for(float i=0;i<512;i++)
{
float temp = i+xstart;
if(temp>0 || temp<512)
ML_DrawSprite(rastaImage, temp, ycenter + sin((i+angle1)*freq1*3.141592654/180.0)*scale);
}
ML_SetColor(255,0,0);
xstart=midWidth-256+10,ycenter=midHeight,scale=28;
for(float i=0;i<512;i++)
{
float temp = i+xstart;
if(temp>0 || temp<512)
ML_DrawSprite(rastaImage, temp, ycenter + sin((i+angle2)*freq2*3.141592654/180.0)*scale);
}
ML_DrawSprite(Surface,midWidth,midHeight);
ML_SetAlpha(0.2);
ML_SetColor(255,0,0);
ML_DrawSprite(haloImage,sin(theta)*200+midWidth,cos(theta/2.0)*200+midHeight);
ML_DrawSprite(haloImage,-sin(theta)*200+midWidth,cos(theta/2.0)*200+midHeight);
ML_SetColor(0,255,0);
ML_DrawSprite(haloImage,sin(theta+1)*200+midWidth,cos(theta/2.0+1)*200+midHeight);
ML_DrawSprite(haloImage,-sin(theta+1)*200+midWidth,cos(theta/2.0+1)*200+midHeight);
ML_SetColor(0,0,255);
ML_DrawSprite(haloImage,sin(theta-1)*200+midWidth,cos(theta/2.0-1)*200+midHeight);
ML_DrawSprite(haloImage,-sin(theta-1)*200+midWidth,cos(theta/2.0-1)*200+midHeight);
ML_Stop2DView();
}
}
/// Called by Ogre, for being a render queue listener
virtual void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &repeatThisInvocation)
{
if( queueGroupId == RENDER_QUEUE_OVERLAY && invocation != "SHADOWS")
{
}
}*/
};