From d961ae306461e1606d37539f512a5d907490531b Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 17 May 2016 23:49:44 +0800 Subject: Fixed a bug in smColorRGBA. Fix and modify smMatrix::lookat. Allow disabling z-test in 3d mode. Add smvec4d. --- include/smcolor.hpp | 2 +- include/smelt.hpp | 2 +- include/smmath.hpp | 44 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 37 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/smcolor.hpp b/include/smcolor.hpp index 94ff4f3..a7feb65 100644 --- a/include/smcolor.hpp +++ b/include/smcolor.hpp @@ -27,7 +27,7 @@ public: friend smColorRGBA operator *(smColorRGBA a,float b){return smColorRGBA(b*a.r,b*a.g,b*a.b,b*a.a);} friend smColorRGBA operator /(smColorRGBA a,float b){return smColorRGBA(a.r/b,a.g/b,a.b/b,a.a/b);} void setHWColor(DWORD col){a=GETA(col)/255.;r=GETR(col)/255.;g=GETG(col)/255.;b=GETB(col)/255.;} - DWORD getHWColor(){clamp();return RGBA(r,g,b,a);} + DWORD getHWColor(){clamp();return RGBA(r*255.,g*255.,b*255.,a*255.);} }; class smColorHSVA { diff --git a/include/smelt.hpp b/include/smelt.hpp index e9caeb3..5c9b013 100644 --- a/include/smelt.hpp +++ b/include/smelt.hpp @@ -350,7 +350,7 @@ public: virtual bool smGetInpEvent(smInpEvent *e)=0; virtual bool smRenderBegin2D(bool ztest=0,SMTRG trg=0)=0; - virtual bool smRenderBegin3D(float fov,SMTRG trg=0)=0; + virtual bool smRenderBegin3D(float fov,bool ztest=0,SMTRG trg=0)=0; virtual bool smRenderEnd()=0; virtual void sm3DCamera6f2v(float *pos,float *rot)=0; virtual void sm2DCamera5f3v(float *pos,float *dpos,float *rot)=0; diff --git a/include/smmath.hpp b/include/smmath.hpp index b9763b7..84ef315 100644 --- a/include/smmath.hpp +++ b/include/smmath.hpp @@ -54,7 +54,7 @@ class smvec3d public: double x,y,z; smvec3d(double _x,double _y,double _z){x=_x;y=_y;z=_z;} - smvec3d(smvec2d a){x=a.x;y=a.y;z=.0;} + smvec3d(smvec2d a,double _z=.0){x=a.x;y=a.y;z=_z;} smvec3d(){x=y=z=.0;} double l(){return sqrt(sqr(x)+sqr(y)+sqr(z));} void normalize(){double L=l();if(L