コード例 #1
0
 private void OnTimer(object state)
 {
     this._sdkCallbackQueue.Switch();
     while (!this._sdkCallbackQueue.isEmpty)
     {
         GBuffer buffer = this._sdkCallbackQueue.Pop();
         if (buffer.data == ( int )GCToLS.MsgID.EMsgToLsfromGcAskLogin)
         {
             uint         gcnetID = buffer.ReadUInt();
             UserPlatform eplat   = ( UserPlatform )buffer.ReadInt();
             if (IfTestPlatform(eplat))
             {
                 this.AsynHandleLoiginCheckMsg_PC(gcnetID);
             }
             // 其他渠道暂不实现 todo
             //else
             //{
             //bool bState = IfPostVisit( platform );
             //string str = gBuffer.ReadUTF8E();
             //new_conn( gcNetID, gBuffer.data, str, this.gGlobalInfoInstance, platform, bState );
             //}
         }
         buffer.position = 0;
         this._sdkCallbackQueuePool.Push(buffer);
     }
 }
コード例 #2
0
        public void RenderIcons(PerspectiveCamera viewPoint, GBuffer gBuffer)
        {
            this.Effect.World      = Matrix.Identity;
            this.Effect.View       = Matrix.Identity;
            this.Effect.Projection = Matrix.Identity;
            this.Effect.DepthMap   = gBuffer.DepthTarget;

            this.Device.PostProcessState();

            for (var i = 0; i < this.Components.Count; i++)
            {
                var component = this.Components[i];
                var pose      = this.Poses.Get(component.Entity);
                var position  = pose.Position;

                if (viewPoint.Frustum.Contains(position) != ContainmentType.Disjoint)
                {
                    var screenPosition = ProjectionMath.WorldToView(position, viewPoint.ViewProjection);

                    this.Effect.World                 = Matrix.CreateScale(new Vector3(IconScale / viewPoint.AspectRatio, IconScale, IconScale)) * Matrix.CreateTranslation(new Vector3(screenPosition, 0));
                    this.Effect.Texture               = this.Library.GetIcon(component.Icon);
                    this.Effect.WorldPosition         = position;
                    this.Effect.CameraPosition        = viewPoint.Position;
                    this.Effect.InverseViewProjection = viewPoint.InverseViewProjection;
                    this.Effect.VisibleTint           = component.BoundaryVisibleTint;
                    this.Effect.ClippedTint           = component.BoundaryClippedTint;

                    this.Effect.Apply(TextureEffectTechniques.TexturePointDepthTest);

                    this.Quad.Render();
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// 把消息编码到缓冲区
 /// </summary>
 public static ErrorCode EncodeProtoMsgToBuffer(IMessage msg, int msgID, GBuffer buffer)
 {
     buffer.Write(msg.ToByteArray());
     buffer.position = 0;
     buffer.data     = msgID;
     return(ErrorCode.Success);
 }
コード例 #4
0
 public void Update(PerspectiveCamera camera, Seconds elapsed, GBuffer gBuffer, Pass pass)
 {
     this.Camera  = camera;
     this.Elapsed = elapsed;
     this.GBuffer = gBuffer;
     this.Pass    = pass;
 }
コード例 #5
0
 public void Send(GBuffer buffer)
 {
     if (null != buffer)
     {
         this._buffer.Post(buffer);
     }
 }
コード例 #6
0
        public bool SplitFromImage32(string sFile, int iCellWidth, int iCellHeight, int iRows, int iColumns, IPoint ipAsCellSpacing, IZone izoneAsMargins)
        {
            GBuffer gbTemp;
            bool    bGood = false;

            try {
                gbTemp = new GBuffer(sFile);
                if (gbTemp.iPixelsTotal == 0)
                {
                    RReporting.ShowErr("Couldn't load image", "SplitFromImage32", "loading font table");
                    bGood = false;
                }
                else
                {
                    //bmpLoaded=gbTemp.bmpLoaded;//SplitFromImage32 remakes bmpLoaded
                    bGood = SplitFromImage32(ref gbTemp, iCellWidth, iCellHeight, iRows, iColumns, ipAsCellSpacing, izoneAsMargins);
                    //sLogLine="Saving test bitmap for debug...";
                    gbTemp.Save(Manager.sDataFolderSlash + "00.test bitmap for SplitFromImage32 debug.png", ImageFormat.Png);
                    //gbTemp.SaveRaw("1.test bitmap for debug.raw");
                    //sLogLine="Done saving test Bitmap for debug";
                }
            }
            catch (Exception exn) {
                RReporting.ShowExn(exn, "SplitFromImage32");
                bGood = false;
            }
            return(bGood);
        }        //end SplitFromImage32
コード例 #7
0
        private ErrorCode DBAsynUpdateGameMail(GBuffer buffer, DBActiveWrapper db)
        {
            CSToDB.UpdateGameMail pMsg = new CSToDB.UpdateGameMail();
            pMsg.MergeFrom(buffer.GetBuffer(), 0, ( int )buffer.length);

            int total = pMsg.Maillist.Count;

            if (total <= 0)
            {
                return(ErrorCode.Success);
            }

            string[] sqlStrs = new string[3];
            sqlStrs[0] = "begin; set autocommit=0;";
            for (int i = 0; i < total; i++)
            {
                CSToDB.GameMailInfo mail = pMsg.Maillist[i];
                if (mail.Curtstate == CSToDB.EMailCurtState.EMailStateDel)
                {
                    sqlStrs[1] = $"update game_mail set mail_del_state ={mail.Curtstate}  where  mail_id={mail.MailId};";
                }
                else if (mail.Curtstate == CSToDB.EMailCurtState.EMailStateNew)
                {
                    sqlStrs[1] =
                        $"insert into game_mail(mail_id,mail_sdk,mail_type,mail_user_id,mail_title,mail_content,mail_gift,mail_send,mail_create_time,mail_over_time,mail_del_state) values({mail.MailId},{mail.Sdkidx},{mail.Type},{mail.Userid},\'{mail.Title}\',\'{mail.Content}\',\'{mail.Giftstr}\',\'{mail.Sender}\',\'{mail.Createtime}\',\'{mail.Overtime}\',{mail.Curtstate});";
                }
            }
            sqlStrs[2] = "commit;";
            return(db.SqlExecNonQuery(sqlStrs));
        }
コード例 #8
0
        public void Update()
        {
            this._dbCallbackQueue.Switch();
            while (!this._dbCallbackQueue.isEmpty)
            {
                GBuffer gBuffer = this._dbCallbackQueue.Pop();
                if (gBuffer.data == 1)
                {
                    uint          gcNetID       = gBuffer.ReadUInt();
                    uint          platform      = gBuffer.ReadUInt();
                    string        uid           = gBuffer.ReadUTF8();
                    string        uin           = gBuffer.ReadUTF8();
                    string        sessionID     = gBuffer.ReadUTF8E();
                    LoginUserInfo loginUserInfo = new LoginUserInfo
                    {
                        sessionid = sessionID,
                        uin       = uin,
                        plat      = platform
                    };
                    this._allLoginUserInfo[sessionID] = loginUserInfo;
                    Logger.Log($"add uid:{uid}, sessionID:{sessionID}");

                    this.PostMsgToGC_NotifyServerList(gcNetID);
                }
                else if (gBuffer.data == 2)
                {
                    uint gcNetID   = gBuffer.ReadUInt();
                    int  errorCode = gBuffer.ReadInt();
                    Logger.Log($"user login fail with netID:{gcNetID}, errorCode:{errorCode}.");
                    this.PostMsgToGC_NotifyLoginFail(errorCode, gcNetID);
                }
                gBuffer.Clear();
                this._dbCallbackQueuePool.Push(gBuffer);
            }
        }
コード例 #9
0
        private ErrorCode DBAsynQueryUserCallBack(GBuffer buffer, DBActiveWrapper db)
        {
            CSToDB.QueryUserReq msg = new CSToDB.QueryUserReq();
            msg.MergeFrom(buffer.GetBuffer(), 0, ( int )buffer.length);

            GCToCS.Login login = new GCToCS.Login();
            login.MergeFrom(ByteString.CopyFromUtf8(msg.Logininfo));

            UserDBData userDbData = new UserDBData();

            userDbData.usrDBData.un64ObjIdx   = ( ulong )msg.Objid;
            userDbData.usrDBData.userPlatform = ( UserPlatform )login.Sdk;

            DBToCS.QueryUser queryUser = new DBToCS.QueryUser();
            this.DBAsynQueryUser(userDbData, queryUser, db);

            using (MemoryStream ms = new MemoryStream())
            {
                Serializer.Serialize(ms, userDbData.usrDBData);
                queryUser.Db       = Encoding.UTF8.GetString(ms.GetBuffer(), 0, ( int )ms.Length);
                queryUser.Login    = msg.Logininfo;
                queryUser.Gcnetid  = msg.Gcnetid;
                queryUser.Gsid     = msg.Gsid;
                queryUser.Nickname = userDbData.szNickName;
            }
            CS.instance.userMgr.EncodeAndSendToLogicThread(queryUser, ( int )DBToCS.MsgID.EQueryUserDbcallBack);
            return(ErrorCode.Success);
        }
コード例 #10
0
 //public void ShowAsciiTable(int xAt, int yAt) {
 //	ShowAsciiTable(Manager.gbScreenStatic, xAt, yAt);
 //}
 public void ShowAsciiTable(GBuffer gbDest, int xAt, int yAt)
 {
     try {
         IPoint ipAt  = new IPoint(xAt, yAt);
         int    lChar = 0;
         for (int yChar = 0; yChar < 16; yChar++)
         {
             ipAt.X = xAt;
             for (int xChar = 0; xChar < 16; xChar++)
             {
                 animarrGlyphType[GFont.GlyphTypeNormal].GotoFrame(lChar);
                 GBuffer.OverlayNoClipToBigCopyAlpha(ref gbDest, ref ipAt, ref animarrGlyphType[GFont.GlyphTypeNormal].gbFrame);
                 //GBuffer.RawOverlayNoClipToBig(ref RetroEngine.gbScreenMain, ref ipAt,
                 //                              ref animarrGlyphType[GFont.GlyphTypeNormal].gbFrame.byarrData,
                 //                              animarrGlyphType[GFont.GlyphTypeNormal].gbFrame.iWidth,
                 //                              animarrGlyphType[GFont.GlyphTypeNormal].gbFrame.iHeight, 1);
                 ipAt.X += animarrGlyphType[GFont.GlyphTypeNormal].gbFrame.iWidth;
                 lChar++;
             }
             ipAt.Y += animarrGlyphType[GFont.GlyphTypeNormal].gbFrame.iHeight;
         }
     }
     catch (Exception exn) {
         RReporting.ShowExn(exn, "GFont ShowAsciiTable");
     }
 }
        private ErrorCode DBAsynInsertNoticeCall(GBuffer buffer, DBActiveWrapper db)
        {
            CSToDB.InsertNotice msg = new CSToDB.InsertNotice();
            msg.MergeFrom(buffer.GetBuffer(), 0, ( int )buffer.length);

            return(db.SqlExecNonQuery(msg.SqlStr));
        }
コード例 #12
0
ファイル: SunlightSystem.cs プロジェクト: third1020/MiniRTS
        public void RenderLights(PerspectiveCamera perspectiveCamera, GBuffer gBuffer)
        {
            this.Device.ShadowCastingLightState();

            for (var i = 0; i < this.Lights.Count; i++)
            {
                var light = this.Lights[i];

                var shadowMapCascades = light.ShadowMapCascades;

                // G-Buffer input
                this.Effect.NormalMap = gBuffer.NormalTarget;
                this.Effect.DepthMap  = gBuffer.DepthTarget;

                // Light properties
                this.Effect.SurfaceToLightVector = shadowMapCascades.SurfaceToLightVector;
                this.Effect.LightColor           = light.Color;

                // Camera properties for specular reflections, and rebuilding world positions
                this.Effect.CameraPosition        = perspectiveCamera.Position;
                this.Effect.InverseViewProjection = perspectiveCamera.InverseViewProjection;

                // Shadow properties
                this.Effect.ShadowMap      = shadowMapCascades.DepthMapArray;
                this.Effect.ColorMap       = shadowMapCascades.ColorMapArray;
                this.Effect.ShadowMatrix   = shadowMapCascades.GlobalShadowMatrix;
                this.Effect.CascadeSplits  = shadowMapCascades.CascadeSplits;
                this.Effect.CascadeOffsets = shadowMapCascades.CascadeOffsets;
                this.Effect.CascadeScales  = shadowMapCascades.CascadeScales;

                this.Effect.Apply();

                this.FullScreenTriangle.Render(this.Device);
            }
        }
コード例 #13
0
        public void RenderParticleWeights(PerspectiveCamera camera, GBuffer gBuffer)
        {
            this.Particles.Clear();

            ParticleHelper.GatherParticles(this.Emitters, camera, this.Particles);

            this.Device.WeightedParticlesState();

            for (var i = 0; i < this.Particles.Count; i++)
            {
                var particle = this.Particles[i];

                this.WeightedParticlesEffect.World                 = particle.Pose;
                this.WeightedParticlesEffect.View                  = camera.View;
                this.WeightedParticlesEffect.Projection            = camera.Projection;
                this.WeightedParticlesEffect.DiffuseMap            = particle.Texture;
                this.WeightedParticlesEffect.Tint                  = particle.Tint.ToVector4();
                this.WeightedParticlesEffect.DepthMap              = gBuffer.DepthTarget;
                this.WeightedParticlesEffect.InverseViewProjection = camera.InverseViewProjection;

                this.WeightedParticlesEffect.Apply();

                this.Quad.SetTextureCoordinates(particle.MinUv, particle.MaxUv);
                this.Quad.Render();
            }
        }
        private ErrorCode DBAsynAlterSNSList(GBuffer buffer, DBActiveWrapper db)
        {
            CSToDB.AlterSNSList msg = new CSToDB.AlterSNSList();
            msg.MergeFrom(buffer.GetBuffer(), 0, ( int )buffer.length);

            return(this.AlterUserSNSList(db, msg.UserId, msg.RelatedId, ( RelationShip )msg.Related, ( DBOperation )msg.Opration));
        }
コード例 #15
0
        public void Render(PerspectiveCamera perspectiveCamera, GBuffer gBuffer)
        {
            this.Device.LightState();

            for (var i = 0; i < this.Lights.Count; i++)
            {
                var light = this.Lights[i];

                // G-Buffer input
                this.Effect.NormalMap = gBuffer.NormalTarget;
                this.Effect.DepthMap  = gBuffer.DepthTarget;

                // Light properties
                this.Effect.LightDirection = light.Direction;
                this.Effect.Color          = light.Color;

                // Camera properties for specular reflections
                this.Effect.CameraPosition        = perspectiveCamera.Position;
                this.Effect.InverseViewProjection = perspectiveCamera.InverseViewProjection;

                this.Effect.Apply();

                this.FullScreenTriangle.Render(this.Device);
            }
        }
コード例 #16
0
		public bool RenderAll(GBuffer gbDest, IRect rectDest) {//, DPoint pOrigin, double rScale, double rSetSeed) {
			bool bGood=false;
			try {
				//int xDest=rectDest.Left;
				//int yDest=rectDest.Top;
				pOrigin.Set((double)xCenterAtPixel,(double)yCenterAtPixel);
				//double rScale=rPixelsPerUnit;//rPixelsPerUnit is formerly rScale
				
				int xEnder=rectDest.X+rectDest.Width;
				int yEnder=rectDest.Y+rectDest.Height;
				double rUnitsPerPixel=1.0/rPixelsPerUnit;
				double xSrcStart=-(pOrigin.X*rUnitsPerPixel);
				double xSrc;
				double rSpeed;
				double ySrc=-(pOrigin.Y*rUnitsPerPixel);
				for (int yDest=rectDest.Y; yDest<yEnder; yDest++) {
					xSrc=xSrcStart;
					for (int xDest=rectDest.X; xDest<xEnder; xDest++) {
						//rSpeed=;
						//this.SetPixelHSVA(xDest,yDest,RMath.SafeAngle360(RMath.THETAOFXY_RAD(xSrc,ySrc))/360.0f,1.0,1.0,1.0);
						double rFractalness=(double)(ResultMandelbrot(xSrc,ySrc,(double)rSeed)%256)/255.0; //RMath.SafeAngle360(ResultMandelbrot(xSrc,ySrc,(double)rSeed))/360.0;
						gbDest.SetPixelHsva(xDest,yDest,rFractalness,1.0,rFractalness,1.0);
						xSrc+=rUnitsPerPixel;
					}
					ySrc+=rUnitsPerPixel;
				}
				bGood=true;
			}
			catch (Exception exn) {	
				bGood=false;
				RReporting.ShowExn(exn,"Fractal RenderAll");
			}
			if (bGood) iFramesRendered++;
			return bGood;
		}//end RenderAll
コード例 #17
0
        /// <summary>
        /// 查询玩家数据的回调函数
        /// 把数据库的所有玩家数据取回内存
        /// </summary>
        private void SynHandleAllAccountCallback(GBuffer buffer)
        {
            DBToCS.QueryAllAccount msg = new DBToCS.QueryAllAccount();
            msg.MergeFrom(buffer.GetBuffer(), 0, ( int )buffer.length);

            for (int i = 0; i < msg.Account.Count; ++i)
            {
                DBToCS.QueryAllAccount.Types.Account pAccount = msg.Account[i];
                //取回所有昵称
                if (!string.IsNullOrEmpty(pAccount.Nickname))
                {
                    this.allNickNameSet.Add(pAccount.Nickname);
                }

                UserCombineKey userCombineKey;
                userCombineKey.sdkid    = pAccount.Sdkid;
                userCombineKey.username = pAccount.UserName;

                ulong guid = ( ulong )pAccount.Guid;
                //取回所有guid
                this.allUserName2GuidMap.Add(userCombineKey, guid);
                if (this._maxGuid < guid)
                {
                    this._maxGuid = guid;
                }
            }
            this._maxGuid /= GUID_Devide;
            Logger.Log($"load maxguid {this._maxGuid}");
        }
コード例 #18
0
        public void RenderIcons(PerspectiveCamera viewPoint, GBuffer gBuffer)
        {
            this.Effect.World      = Matrix.Identity;
            this.Effect.View       = Matrix.Identity;
            this.Effect.Projection = Matrix.Identity;
            this.Effect.DepthMap   = gBuffer.DepthTarget;

            this.Device.PostProcessState();

            foreach ((var entity, var component, var info, var property, var attribute) in this.EnumerateAttributes <IconAttribute>())
            {
                var position = (Vector3)property.GetGetMethod().Invoke(component, null);

                if (viewPoint.Frustum.Contains(position) != ContainmentType.Disjoint)
                {
                    var screenPosition = ProjectionMath.WorldToView(position, viewPoint.ViewProjection);

                    this.Effect.World                 = Matrix.CreateScale(new Vector3(Scale / viewPoint.AspectRatio, Scale, Scale)) * Matrix.CreateTranslation(new Vector3(screenPosition, 0));
                    this.Effect.Texture               = this.Library.GetIcon(attribute.Type);
                    this.Effect.WorldPosition         = position;
                    this.Effect.CameraPosition        = viewPoint.Position;
                    this.Effect.InverseViewProjection = viewPoint.InverseViewProjection;
                    this.Effect.VisibleTint           = info.VisibileIconTint;
                    this.Effect.ClippedTint           = info.ClippedIconTint;

                    this.Effect.Apply(TextureEffectTechniques.TexturePointDepthTest);

                    this.Quad.Render();
                }
            }
        }
        private ErrorCode DBAsyAlterItemCallBack(GBuffer buffer, DBActiveWrapper db)
        {
            CSToDB.AlterItem msg = new CSToDB.AlterItem();
            msg.MergeFrom(buffer.GetBuffer(), 0, ( int )buffer.length);

            return(this.DBAsynAlterUserItem(db, msg.SqlStr));
        }
コード例 #20
0
        private void SynUserAskDBCallBack()
        {
            this._dbCallbackQueue.Switch();
            while (!this._dbCallbackQueue.isEmpty)
            {
                GBuffer      buffer = this._dbCallbackQueue.Pop();
                DBToCS.MsgID msgID  = (DBToCS.MsgID)buffer.data;
                switch (msgID)
                {
                case DBToCS.MsgID.EQueryUserDbcallBack:
                    this.SynHandleQueryUserCallback(buffer);
                    break;

                case DBToCS.MsgID.EQueryAllAccountCallBack:
                    this.SynHandleAllAccountCallback(buffer);
                    break;

                case DBToCS.MsgID.EMailCallBack:
                    this.SynHandleMailCallback(buffer);
                    break;

                case DBToCS.MsgID.EQueryNoticeCallBack:
                    this.DBCallBackQueryNotice(buffer);
                    break;

                default:
                    Logger.Warn($"not hv handler:{buffer.data}");
                    break;
                }
                this._dbCallbackQueuePool.Push(buffer);
            }
        }
        /// <summary>
        /// 异步方式储存玩家数据
        /// </summary>
        private void UserCacheDBAsynHandler(GBuffer buffer)
        {
            DBActiveWrapper db = this.GetDBSource(buffer.actorID);

            CSToDB.MsgID msgID = (CSToDB.MsgID)buffer.data;
            switch (msgID)
            {
            case CSToDB.MsgID.EUpdateUserDbcallBack:
                this.DBAsynUpdateUserCallback(buffer, db);
                break;

            case CSToDB.MsgID.EAlterSnslistDbcall:
                this.DBAsynAlterSNSList(buffer, db);
                break;

            case CSToDB.MsgID.EAlterItemDbcall:
                this.DBAsyAlterItemCallBack(buffer, db);
                break;

            case CSToDB.MsgID.EInsertNoticeDbcall:
                this.DBAsynInsertNoticeCall(buffer, db);
                break;

            default:
                Logger.Error("unknown msg");
                break;
            }
        }
コード例 #22
0
        public bool TypeFast(ref GBuffer gbDest, ref IPoint ipDest, string sText, int iGlyphType)
        {
            bool   bGood = true;
            IPoint ipDestNow;

            try {
                ipDestNow   = new IPoint();
                ipDestNow.X = ipDest.X;
                ipDestNow.Y = ipDest.Y;
                char[] carrText = sText.ToCharArray();
                for (int i = 0; i < carrText.Length; i++)
                {
                    animarrGlyphType[iGlyphType].GotoFrame((long)carrText[i]);
                    if (!GBuffer.OverlayNoClipToBigCopyAlpha(ref gbDest, ref ipDestNow, ref animarrGlyphType[iGlyphType].gbFrame, ref gradNow))
                    {
                        bGood = false;
                        RReporting.ShowErr("failed to overlay text character#" + ((long)carrText[i]).ToString(), "TypeFast");
                    }
                    ipDestNow.X += animarrGlyphType[iGlyphType].gbFrame.iWidth;
                }
            }
            catch (Exception exn) {
                RReporting.ShowExn(exn, "TypeFast(...,\"" + sText + "\")");
                bGood = false;
            }
            return(bGood);
        }
コード例 #23
0
        }        //end SplitFromImage32

        /// <summary>
        /// Changes the frame order from top to bottom to left to right using
        /// the idea that the frames are currently wrapped to a square whose
        /// number of rows are specified by the number of output columns you
        /// specify.
        /// </summary>
        /// <param name="iResultCols"></param>
        /// <returns></returns>
        public bool TransposeFramesAsMatrix(int iResultRows, int iResultCols)
        {
            //TODO: exception handling
            bool bGood = false;

            GBuffer[] gbarrNew;
            string    sDebug = "starting TranslateFrameOrder" + Environment.NewLine;

            RString.StringToFile("C:\\DOCUME~1\\OWNER\\MYDOCU~1\\DATABOX\\anim.TranslateFrameOrder debug.txt", sDebug);
            try {
                gbarrNew = new GBuffer[(int)lFrames];
                int iFrames = (int)lFrames;
                for (int iFrame = 0; iFrame < iFrames; iFrame++)
                {
                    int iNew = (int)(iFrame / iResultCols) + (int)(iFrame % iResultCols) * iResultRows;           //switched (must be)
                    sDebug          += "old:" + iFrame.ToString() + "; new:" + iNew.ToString() + Environment.NewLine;
                    gbarrNew[iFrame] = gbarrAnim[iNew];
                }
                gbarrAnim = gbarrNew;
                RString.StringToFile("C:\\Documents and Settings\\Owner\\My Documents\\Databox\\anim.TranslateFrameOrder debug.txt", sDebug);
                gbFrame = gbarrAnim[this.lFrameNow];
                bGood   = true;
            }
            catch (Exception exn) {
                sDebug += "Exception!" + exn.ToString() + Environment.NewLine;
                //TODO: handle exception
            }
            sDebug += "Finished.";
            //TODO: in future don't set bGood according to StringToFile
            bGood = RString.StringToFile("C:\\Documents and Settings\\Owner\\My Documents\\Databox\\anim.TranslateFrameOrder debug.txt", sDebug);
            return(bGood);
        }        //end TranslateFrameOrder
コード例 #24
0
 public void Update(PerspectiveCamera camera, ModelRenderBatch batch, GBuffer gBuffer, Pass pass)
 {
     this.Camera  = camera;
     this.Batch   = batch;
     this.GBuffer = gBuffer;
     this.Pass    = pass;
 }
コード例 #25
0
ファイル: ProjectorSystem.cs プロジェクト: third1020/MiniRTS
        public void RenderProjectors(PerspectiveCamera perspectiveCamera, GBuffer gBuffer)
        {
            this.Device.PostProcessState();

            for (var i = 0; i < this.Projectors.Count; i++)
            {
                var projector = this.Projectors[i];
                if (projector.ViewPoint.Frustum.Intersects(perspectiveCamera.Frustum))
                {
                    //G-Buffer input
                    this.Effect.DepthMap = gBuffer.DepthTarget;

                    // Projector properties
                    this.Effect.ProjectorMap            = projector.Texture;
                    this.Effect.Mask                    = projector.Mask;
                    this.Effect.ProjectorViewProjection = projector.ViewPoint.ViewProjection;
                    this.Effect.MaxDistance             = projector.MaxDistance;
                    this.Effect.ProjectorPosition       = projector.ViewPoint.Position;
                    this.Effect.ProjectorForward        = projector.ViewPoint.Forward;
                    this.Effect.Tint                    = projector.Tint;

                    // Camera properties
                    this.Effect.World                 = Matrix.Identity;
                    this.Effect.View                  = perspectiveCamera.View;
                    this.Effect.Projection            = ProjectionMath.ComputeProjectionMatrixThatFitsFrustum(perspectiveCamera, projector.ViewPoint.Frustum);
                    this.Effect.InverseViewProjection = perspectiveCamera.InverseViewProjection;

                    this.Effect.Apply(this.Technique);

                    this.FrustumDrawer.Render(projector.ViewPoint.Frustum);
                }
            }
        }
コード例 #26
0
        private void drawGBuffer(GBuffer buffer)
        {
            //gBuffer.Clear(Microsoft.Xna.Framework.Graphics.Color.SkyBlue.dx());
            buffer.Clear();
            buffer.SetTargetsToOutputMerger();

            drawGBufferMeshes();
        }
コード例 #27
0
        public static DeferredMeshesRenderer InitDefaultMeshRenderer(DX11Game game, GBuffer gBuffer)
        {
            var texturePool = new TexturePool(game);

            var renderer = new DeferredMeshesRenderer(game, gBuffer, texturePool);

            return(renderer);
        }
コード例 #28
0
 public void Update(PerspectiveCamera camera, Seconds elapsed, GBuffer gBuffer, Pass pass, TextureCube skybox)
 {
     this.Camera  = camera;
     this.Elapsed = elapsed;
     this.GBuffer = gBuffer;
     this.Pass    = pass;
     this.Skybox  = skybox;
 }
コード例 #29
0
        public DeferredMeshesRenderer(DX11Game game, GBuffer gBuffer, TexturePool texturePool)
        {
            this.game = game;
            this.pool = texturePool;
            ctx       = game.Device.ImmediateContext;

            initialize(texturePool);
        }
コード例 #30
0
        public DeferredRenderPipeline(
            GraphicsDevice device,
            ShadowMapSystem shadowMapSystem,
            ModelSystem modelSystem,
            AveragedParticleSystem particleSystem,
            AdditiveParticleSystem additiveParticleSystem,
            ProjectorSystem projectorSystem,
            EffectFactory effectFactory,
            AmbientLightSystem ambientLightSystem,
            DirectionalLightSystem directionalLightSystem,
            PointLightSystem pointLightSystem,
            CascadedShadowMapSystem cascadedShadowMapSystem,
            ShadowCastingLightSystem shadowCastingLightSystem,
            SunlightSystem sunlightSystem,
            BoundarySystem boundarySystem,
            DynamicTextureSystem dynamicTextureSystem,
            IconSystem iconSystem,
            CutsceneSystem cutsceneSystem,
            IMeterRegistry meterRegistry)
        {
            this.ShadowMapSystem           = shadowMapSystem;
            this.ModelSystem               = modelSystem;
            this.TransparentParticleSystem = particleSystem;
            this.AdditiveParticleSystem    = additiveParticleSystem;
            this.ProjectorSystem           = projectorSystem;
            this.CombineEffect             = effectFactory.Construct <CombineEffect>();
            this.FxaaEffect               = effectFactory.Construct <FxaaEffect>();
            this.AmbientLightSystem       = ambientLightSystem;
            this.DirectionalLightSystem   = directionalLightSystem;
            this.PointLightSystem         = pointLightSystem;
            this.CascadedShadowMapSystem  = cascadedShadowMapSystem;
            this.ShadowCastingLightSystem = shadowCastingLightSystem;
            this.SunlightSystem           = sunlightSystem;
            this.BoundarySystem           = boundarySystem;
            this.DynamicTextureSystem     = dynamicTextureSystem;
            this.CutsceneSystem           = cutsceneSystem;
            this.IconSystem               = iconSystem;

            var width  = device.PresentationParameters.BackBufferWidth;
            var height = device.PresentationParameters.BackBufferHeight;

            this.GBuffer = new GBuffer(device, width, height);

            this.Input = new RenderPipelineInput();

            this.Settings = new RenderPipelineSettings();

            this.ShadowPipeline    = ShadowPipeline.Create(device, meterRegistry);
            this.LightingPipeline  = LightingPipeline.Create(device, meterRegistry);
            this.ModelPipeline     = ModelPipeline.Create(device, meterRegistry);
            this.ParticlePipeline  = ParticlePipeline.Create(device, meterRegistry);
            this.ProjectorPipeline = ProjectorPipeline.Create(device, meterRegistry);

            this.Pipeline = RenderPipeline.Create(device, meterRegistry);
            this.RootPass = new Pass(PassType.Opaque, 0);

            this.Recreate();
        }