aboutsummaryrefslogtreecommitdiff
path: root/visualization/qmpvisualization.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-02-12 00:36:04 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-02-15 18:44:07 +0800
commit002baf9367417604412ed19d283835c23454349e (patch)
tree5f01620819966a3eb6980e80262309f453778fe5 /visualization/qmpvisualization.cpp
parent0db7268f5b81f39a4126782c2fef4282c2e75dd8 (diff)
downloadQMidiPlayer-002baf9367417604412ed19d283835c23454349e.tar.xz
Measure indicators are now solid frames instead of ugly grey cubes.
Fixed multiple embodiment of stupidness in the code.
Diffstat (limited to 'visualization/qmpvisualization.cpp')
-rw-r--r--visualization/qmpvisualization.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index 899597a..e725263 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -274,26 +274,26 @@ void qmpVisualization::updateVisualization3D()
if(fabs((double)pool[i]->tcs-ctk)*lpt<viewdist*2||fabs((double)pool[i]->tce-ctk)*lpt<viewdist*2)
{
if(pool[i]->ch==999){
- if(!horizontal&&stairpiano){
- for(int ch=0;ch<16;++ch){
- smvec3d a(0.63*(-80)+.1,(stairpiano?(56-ch*7.):(64-ch*8.))-1,((double)pool[i]->tce+1-ctk)*lpt+(stairpiano&&showpiano&&!horizontal)*ch*2.);
- smvec3d b(0.63*80+.7,(stairpiano?(56-ch*7.):(64-ch*8.))+4,((double)pool[i]->tcs-ctk)*lpt+(stairpiano&&showpiano&&!horizontal)*ch*2.);
- if(horizontal){
- a=smvec3d(((double)pool[i]->tcs-ctk)*lpt-20,(16-ch*2.),0.63*(-64)+.1);
- b=smvec3d(((double)pool[i]->tce+1-ctk)*lpt-20,(16-ch*2.)+.4,0.63*64+.7);
- }
- if(showmeasure)drawCube(a,b,0x80808080,0);
- }
+ smvec3d a(0.63*(-64)+.1-10,(stairpiano?(56-0*7.):(64-0*8.))+10,((double)pool[i]->tcs-ctk)*lpt-minnotelength*.005);
+ smvec3d b(0.63*64+.7+10,(stairpiano?(56-15*7.):(64-15*8.))+.4-10,((double)pool[i]->tcs-ctk)*lpt+minnotelength*.005);
+ if(horizontal){
+ a=smvec3d(((double)pool[i]->tcs-ctk)*lpt-20-minnotelength*.001,(16- 0*2.)+2.4,0.63*(-64)+.1);
+ b=smvec3d(((double)pool[i]->tcs-ctk)*lpt-20+minnotelength*.001,(16-15*2.)+0.4,0.63*64+.7);
}
- else{
- smvec3d a(0.63*(-64)+.1,(stairpiano?(56-0*7.):(64-0*8.)),((double)pool[i]->tce+1-ctk)*lpt+(stairpiano&&showpiano&&!horizontal)*0*2.);
- smvec3d b(0.63*64+.7,(stairpiano?(56-15*7.):(64-15*8.))+.4,((double)pool[i]->tcs-ctk)*lpt+(stairpiano&&showpiano&&!horizontal)*15*2.);
- if(horizontal){
- a=smvec3d(((double)pool[i]->tcs-ctk)*lpt-20,(16-0*2.),0.63*(-64)+.1);
- b=smvec3d(((double)pool[i]->tce+1-ctk)*lpt-20,(16-15*2.)+.4,0.63*64+.7);
+ smMatrix I;I.loadIdentity();
+ smEntity3D c=smEntity3D::cube(a,b,0xFF000000,horizontal?51:60);
+ if(stairpiano&&showpiano&&!horizontal)
+ {
+ std::vector<size_t> il={2,3,6,7};
+ for(size_t ti:il)
+ {
+ smVertex t=c.vertex(ti);
+ t.z+=30;
+ c.setVertex(ti,t);
}
- if(showmeasure)drawCube(a,b,0x80808080,0);
}
+ if(showmeasure)
+ nebuf->addTransformedEntity(&c,I,smvec3d(0,0,0));
continue;
}
if(api->getChannelMask(pool[i]->ch))continue;
@@ -707,13 +707,13 @@ bool qmpVisualization::update()
return shouldclose;
}
-void qmpVisualization::drawCube(smvec3d a,smvec3d b,DWORD col,SMTEX tex)
+void qmpVisualization::drawCube(smvec3d a,smvec3d b,DWORD col,SMTEX tex,int faces)
{
smQuad q;q.blend=BLEND_ALPHABLEND;
q.tex=tex;for(int i=0;i<4;++i)q.v[i].col=col;
if(noteappearance==1)
{
- smMatrix I;I.loadIdentity();smEntity3D c=smEntity3D::cube(a,b,col);
+ smMatrix I;I.loadIdentity();smEntity3D c=smEntity3D::cube(a,b,col,faces);
nebuf->addTransformedEntity(&c,I,smvec3d(0,0,0));
}
else