-
Notifications
You must be signed in to change notification settings - Fork 1
/
DrawScene.m
65 lines (49 loc) · 1.51 KB
/
DrawScene.m
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
function DrawScene(count, alphaValue)
global ROOM
global GL
global EXP
global TRIAL
global SESSION
X=1; %x coordinate
Y=2; %y coordinate
Z=3; %z coordinate
T=4; %T: theta (viewangle)
S=5; %S: speed
glPushMatrix;
% glRotated (0,1,0,0); % to look a little bit downward
glRotated(TRIAL.posdata(count,T)/pi*180,0,1,0);
glTranslated(-TRIAL.posdata(count,X),0,-TRIAL.posdata(count,Z));
% glTranslated (-dax,0,dbx);
% implement drawscene
% DrawScene()
% glDisable(GL.LIGHTING);
glEnable(GL.BLEND);
% glBlendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA);
if nargin<2
mazeStartCount = find(TRIAL.trialActive, 1, 'first');
dCount = count-mazeStartCount+1;
if ~isfield(EXP, 'fadeInFrames')
EXP.fadeInFrames = 30;
end
if dCount<=EXP.fadeInFrames
alphaValue = (-cos(dCount/(EXP.fadeInFrames*2)*2*pi)+1)/2;
else
alphaValue = 1;
end
end
glBlendColor(0, 0, 0, alphaValue);
glBlendFunc(GL.CONSTANT_ALPHA, GL.ONE_MINUS_CONSTANT_ALPHA);
glMaterialfv(GL.FRONT_AND_BACK, GL.AMBIENT, [1 1 1 1]);
for k=1:ROOM.nOfWalls
texInd = getTextureIndex(GL.wallTextures{k}, SESSION.textures);
wallface(ROOM.v, ROOM.order(k,:),ROOM.normals(k,:), GL.texname(texInd), ROOM.wrap{k});
end
% glMaterialfv(GL.FRONT_AND_BACK, GL.AMBIENT, [1 0 1 1]);
% for k=1:ROOM.nOfWalls
% texInd = getTextureIndex(GL.wallTextures{k}, SESSION.textures);
% texInd = 7;
% wallface(ROOM.v, ROOM.order(k,:),ROOM.normals(k,:), GL.texname(texInd), ROOM.wrap{k});
% end
glDisable(GL.BLEND);
% glEnable(GL.LIGHTING);
glPopMatrix;