当前位置: 首页>>代码示例>>C#>>正文


C# Game.GLPopMatrix方法代码示例

本文整理汇总了C#中Game.GLPopMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# Game.GLPopMatrix方法的具体用法?C# Game.GLPopMatrix怎么用?C# Game.GLPopMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game.GLPopMatrix方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNewFrameDraw3d

 public override void OnNewFrameDraw3d(Game game, float deltaTime)
 {
     float one = 1;
     for (int i = 0; i < game.entitiesCount; i++)
     {
         Entity entity = game.entities[i];
         if (entity == null) { continue; }
         if (entity.sprite == null) { continue; }
         Sprite b = entity.sprite;
         game.GLMatrixModeModelView();
         game.GLPushMatrix();
         game.GLTranslate(b.positionX, b.positionY, b.positionZ);
         Billboard(game);
         game.GLScale((one * 2 / 100), (one * 2 / 100), (one * 2 / 100));
         game.GLTranslate(0 - b.size / 2, 0 - b.size / 2, 0);
         //d_Draw2d.Draw2dTexture(night ? moontexture : suntexture, 0, 0, ImageSize, ImageSize, null, Color.White);
         IntRef n = null;
         if (b.animationcount > 0)
         {
             float progress = one - (entity.expires.timeLeft / entity.expires.totalTime);
             n = IntRef.Create(game.platform.FloatToInt(progress * (b.animationcount * b.animationcount - 1)));
         }
         game.Draw2dTexture(game.GetTexture(b.image), 0, 0, b.size, b.size, n, b.animationcount, Game.ColorFromArgb(255, 255, 255, 255), true);
         game.GLPopMatrix();
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:26,代码来源:DrawSprites.ci.cs

示例2: DrawCompass

    public void DrawCompass(Game game)
    {
        if (!CompassInActiveMaterials(game)) return;
        if (compassid == -1)
        {
            compassid = game.GetTexture("compass.png");
            needleid = game.GetTexture("compassneedle.png");
        }
        float size = 175;
        float posX = game.Width() - 100;
        float posY = 100;
        float playerorientation = -((game.player.position.roty / (2 * Game.GetPi())) * 360);

        compassvertex += (playerorientation - compassangle) / 50;
        compassvertex *= (one * 9 / 10);
        compassangle += compassvertex;

        // compass
        game.Draw2dTexture(compassid, posX - size / 2, posY - size / 2, size, size, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);

        // compass needle
        game.GLPushMatrix();
        game.GLTranslate(posX, posY, 0);
        game.GLRotate(compassangle, 0, 0, 90);
        game.GLTranslate(-size / 2, -size / 2, 0);
        game.Draw2dTexture(needleid, 0, 0, size, size, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
        game.GLPopMatrix();
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:28,代码来源:Compass.ci.cs

示例3: OnNewFrameDraw3d

    public override void OnNewFrameDraw3d(Game game, float deltaTime)
    {
        for (int i = 0; i < game.entitiesCount; i++)
        {
            Entity e = game.entities[i];
            if (e == null)
            {
                continue;
            }
            if (e.drawText == null)
            {
                continue;
            }
            if (e.networkPosition != null && (!e.networkPosition.PositionLoaded))
            {
                continue;
            }
            int kKey = i;
            EntityDrawText p = game.entities[i].drawText;
            float posX = - game.platform.MathSin(e.position.roty) * p.dx + e.position.x;
            float posY = p.dy + e.position.y;
            float posZ = game.platform.MathCos(e.position.roty) * p.dz + e.position.z;
            //todo if picking
            if ((game.Dist(game.player.position.x, game.player.position.y, game.player.position.z, posX, posY, posZ) < 20)
                || game.keyboardState[Game.KeyAltLeft] || game.keyboardState[Game.KeyAltRight])
            {
                string text = p.text;
                {

                    float shadow = (game.one * game.GetLight(game.platform.FloatToInt(posX), game.platform.FloatToInt(posZ), game.platform.FloatToInt(posY))) / Game.maxlight;

                    game.GLPushMatrix();
                    game.GLTranslate(posX, posY, posZ);

                    game.GLRotate(180, 1, 0, 0);
                    game.GLRotate(e.position.roty * 360 / (2 * Game.GetPi()), 0, 1, 0);
                    float scale = game.one * 5 / 1000;
                    game.GLScale(scale, scale, scale);

                    FontCi font = new FontCi();
                    font.family = "Arial";
                    font.size = 14;
                    game.Draw2dText(text, font, -game.TextSizeWidth(text, 14) / 2, 0, IntRef.Create(Game.ColorFromArgb(255, 255, 255, 255)), true);

                    game.GLPopMatrix();
                }
            }
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:49,代码来源:DrawText.ci.cs

示例4: DrawWireframeCube_

    public void DrawWireframeCube_(Game game, float posx, float posy, float posz, float scalex, float scaley, float scalez)
    {
        game.platform.GLLineWidth(2);

        game.platform.BindTexture2d(0);

        if (wireframeCube == null)
        {
            ModelData data = WireframeCube.Get();
            wireframeCube = game.platform.CreateModel(data);
        }
        game.GLPushMatrix();
        game.GLTranslate(posx, posy, posz);
        float half = one / 2;
        game.GLScale(scalex * half, scaley * half, scalez * half);
        game.DrawModel(wireframeCube);
        game.GLPopMatrix();
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:18,代码来源:DrawLinesAroundSelectedBlock.ci.cs

示例5: DrawTestModel

 void DrawTestModel(Game game, float deltaTime)
 {
     if (!game.ENABLE_DRAW_TEST_CHARACTER)
     {
         return;
     }
     if (testmodel == null)
     {
         testmodel = new AnimatedModelRenderer();
         byte[] data = game.GetFile("player.txt");
         int dataLength = game.GetFileLength("player.txt");
         string dataString = game.platform.StringFromUtf8ByteArray(data, dataLength);
         AnimatedModel model = AnimatedModelSerializer.Deserialize(game.platform, dataString);
         testmodel.Start(game, model);
     }
     game.GLPushMatrix();
     game.GLTranslate(game.map.MapSizeX / 2, game.blockheight(game.map.MapSizeX / 2, game.map.MapSizeY / 2 - 2, 128), game.map.MapSizeY / 2 - 2);
     game.platform.BindTexture2d(game.GetTexture("mineplayer.png"));
     testmodel.Render(deltaTime, 0, true, true, 1);
     game.GLPopMatrix();
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:21,代码来源:DrawTestModel.ci.cs

示例6: Draw

 public void Draw(Game game, float fov)
 {
     if (SkyTexture == -1)
     {
         game.platform.ThrowException("InvalidOperationException");
     }
     int size = 1000;
     if (skymodel == null)
     {
         skymodel = game.platform.CreateModel(SphereModelData.GetSphereModelData(size, size, 20, 20));
     }
     game.Set3dProjection(size * 2, fov);
     game.GLMatrixModeModelView();
     game.GLPushMatrix();
     game.GLTranslate(game.player.position.x,
         game.player.position.y,
         game.player.position.z);
     game.platform.BindTexture2d(SkyTexture);
     game.DrawModel(skymodel);
     game.GLPopMatrix();
     game.Set3dProjection(game.zfar(), fov);
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:22,代码来源:SkySphereStatic.ci.cs

示例7: OnNewFrameDraw3d

    public override void OnNewFrameDraw3d(Game game, float dt)
    {
        GamePlatform platform = game.platform;
        game.GLMatrixModeModelView();
        if (suntexture == -1)
        {
            suntexture = game.GetTexture("sun.png");
            moontexture = game.GetTexture("moon.png");
        }
        UpdateSunMoonPosition(game, dt);

        float posX;
        float posY;
        float posZ;
        if (!game.isNight)
        {
            posX = game.sunPositionX;
            posY = game.sunPositionY;
            posZ = game.sunPositionZ;
        }
        else
        {
            posX = game.moonPositionX;
            posY = game.moonPositionY;
            posZ = game.moonPositionZ;
        }
        posX += game.player.position.x;
        posY += game.player.position.y;
        posZ += game.player.position.z;

        game.GLPushMatrix();
        game.GLTranslate(posX, posY, posZ);
        ModDrawSprites.Billboard(game);
        game.GLScale(one * 2 / 100, one * 2 / 100, one * 2 / 100);
        //GL.Translate(-ImageSize / 2, -ImageSize / 2, 0);
        game.Draw2dTexture(game.isNight ? moontexture : suntexture, 0, 0, ImageSize, ImageSize, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
        game.GLPopMatrix();
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:38,代码来源:SunMoonRenderer.ci.cs

示例8: Draw

 public void Draw(Game game, float fov)
 {
     int size = 1000;
     if (game.fancySkysphere)
     {
         //Fancy skysphere with higher resolution
         skymodel = GetSphereModelData2(skymodel, game.platform, size, size, 64, 64, skyPixels, glowPixels, game.sunPositionX, game.sunPositionY, game.sunPositionZ);
     }
     else
     {
         //Normal resolution. Far more FPS
         skymodel = GetSphereModelData2(skymodel, game.platform, size, size, 20, 20, skyPixels, glowPixels, game.sunPositionX, game.sunPositionY, game.sunPositionZ);
     }
     game.Set3dProjection(size * 2, fov);
     game.GLMatrixModeModelView();
     game.GLPushMatrix();
     game.GLTranslate(game.player.position.x,
         game.player.position.y,
         game.player.position.z);
     game.platform.BindTexture2d(0);
     game.DrawModelData(skymodel);
     game.GLPopMatrix();
     game.Set3dProjection(game.zfar(), fov);
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:24,代码来源:SkySphereAnimated.ci.cs

示例9: Draw

 public void Draw(Game game, float positionX, float positionY, float positionZ, VehicleDirection12 dir, VehicleDirection12 lastdir, float progress)
 {
     float one = 1;
     if (minecarttexture == -1)
     {
         minecarttexture = game.GetTexture("minecart.png");
     }
     game.GLPushMatrix();
     float pX = positionX;
     float pY = positionY;
     float pZ = positionZ;
     pY += -(one * 7 / 10);
     game.GLTranslate(pX, pY, pZ);
     float currot = vehiclerotation(dir);
     float lastrot = vehiclerotation(lastdir);
     //double rot = lastrot + (currot - lastrot) * progress;
     float rot = AngleInterpolation.InterpolateAngle360(game.platform, lastrot, currot, progress);
     game.GLRotate(-rot - 90, 0, 1, 0);
     RectangleFloat[] cc = CuboidRenderer.CuboidNet(8, 8, 8, 0, 0);
     CuboidRenderer.CuboidNetNormalize(cc, 32, 16);
     game.platform.BindTexture2d(minecarttexture);
     CuboidRenderer.DrawCuboid(game, -(one * 5 / 10), -(one * 3 / 10), -(one * 5 / 10), 1, 1, 1, cc, 1);
     game.GLPopMatrix();
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:24,代码来源:MinecartRenderer.ci.cs

示例10: DrawPlayers

    internal void DrawPlayers(Game game, float dt)
    {
        game.totaltimeMilliseconds = game.platform.TimeMillisecondsFromStart();
        for (int i = 0; i < game.entitiesCount; i++)
        {
            if (game.entities[i] == null)
            {
                continue;
            }
            if (game.entities[i].drawModel == null)
            {
                continue;
            }
            Entity p_ = game.entities[i];
            if (i == game.LocalPlayerId && (!game.ENABLE_TPP_VIEW))
            {
                continue;
            }
            if ((p_.networkPosition != null) && (!p_.networkPosition.PositionLoaded))
            {
                continue;
            }
            if (!game.d_FrustumCulling.SphereInFrustum(p_.position.x, p_.position.y, p_.position.z, 3))
            {
                continue;
            }
            if (p_.drawModel.CurrentTexture == -1)
            {
                continue;
            }
            int cx = game.platform.FloatToInt(p_.position.x) / Game.chunksize;
            int cy = game.platform.FloatToInt(p_.position.z) / Game.chunksize;
            int cz = game.platform.FloatToInt(p_.position.y) / Game.chunksize;
            if (game.map.IsValidChunkPos(cx, cy, cz))
            {
                if (!game.map.IsChunkRendered(cx, cy, cz))
                {
                    continue;
                }
            }
            float shadow = (one * game.GetLight(game.platform.FloatToInt(p_.position.x), game.platform.FloatToInt(p_.position.z), game.platform.FloatToInt(p_.position.y))) / Game.maxlight;
            if (p_.playerDrawInfo == null)
            {
                p_.playerDrawInfo = new PlayerDrawInfo();
            }
            p_.playerDrawInfo.anim.light = shadow;
            float FeetPosX = p_.position.x;
            float FeetPosY = p_.position.y;
            float FeetPosZ = p_.position.z;
            AnimationHint animHint = game.entities[i].playerDrawInfo.AnimationHint_;

            float playerspeed_;
            if (i == game.LocalPlayerId)
            {
                if (game.player.playerDrawInfo == null)
                {
                    game.player.playerDrawInfo = new PlayerDrawInfo();
                }
                Vector3Ref playerspeed = Vector3Ref.Create(game.playervelocity.X / 60, game.playervelocity.Y / 60, game.playervelocity.Z / 60);
                float playerspeedf = playerspeed.Length() * (one * 15 / 10);
                game.player.playerDrawInfo.moves = playerspeedf != 0;
                playerspeed_ = playerspeedf;
            }
            else
            {
                playerspeed_ = (game.Length(p_.playerDrawInfo.velocityX, p_.playerDrawInfo.velocityY, p_.playerDrawInfo.velocityZ) / dt) * (one * 4 / 100);
            }

            {
                if (p_.drawModel.renderer == null)
                {
                    p_.drawModel.renderer = new AnimatedModelRenderer();
                    byte[] data = game.GetFile(p_.drawModel.Model_);
                    int dataLength = game.GetFileLength(p_.drawModel.Model_);
                    if (data != null)
                    {
                        string dataString = game.platform.StringFromUtf8ByteArray(data, dataLength);
                        AnimatedModel model = AnimatedModelSerializer.Deserialize(game.platform, dataString);
                        p_.drawModel.renderer.Start(game, model);
                    }
                }
                game.GLPushMatrix();
                game.GLTranslate(FeetPosX, FeetPosY, FeetPosZ);
                //game.GLRotate(PlayerInterpolate.RadToDeg(p_.position.rotx), 1, 0, 0);
                game.GLRotate(PlayerInterpolate.RadToDeg(-p_.position.roty + Game.GetPi()), 0, 1, 0);
                //game.GLRotate(PlayerInterpolate.RadToDeg(p_.position.rotz), 0, 0, 1);
                game.platform.BindTexture2d(game.entities[i].drawModel.CurrentTexture);
                p_.drawModel.renderer.Render(dt, PlayerInterpolate.RadToDeg(p_.position.rotx + Game.GetPi()), true, p_.playerDrawInfo.moves, shadow);
                game.GLPopMatrix();
            }
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:92,代码来源:DrawPlayers.ci.cs

示例11: OnNewFrameDraw3d

    public override void OnNewFrameDraw3d(Game game, float deltaTime)
    {
        for (int i = 0; i < game.entitiesCount; i++)
        {
            Entity e = game.entities[i];
            if (e == null)
            {
                continue;
            }
            if (e.drawName == null)
            {
                continue;
            }
            if (i == game.LocalPlayerId)
            {
                continue;
            }
            if (e.networkPosition != null && (!e.networkPosition.PositionLoaded))
            {
                continue;
            }
            int kKey = i;
            DrawName p = game.entities[i].drawName;
            if (p.OnlyWhenSelected)
            {
                continue;
            }
            float posX = p.TextX + e.position.x;
            float posY = p.TextY + e.position.y + e.drawModel.ModelHeight + game.one * 7 / 10;
            float posZ = p.TextZ + e.position.z;
            //todo if picking
            if ((game.Dist(game.player.position.x, game.player.position.y, game.player.position.z, posX, posY, posZ) < 20)
                || game.keyboardState[Game.KeyAltLeft] || game.keyboardState[Game.KeyAltRight])
            {
                string name = p.Name;
                {

                    float shadow = (game.one * game.GetLight(game.platform.FloatToInt(posX), game.platform.FloatToInt(posZ), game.platform.FloatToInt(posY))) / Game.maxlight;
                    //do not interpolate player position if player is controlled by game world
                    //if (EnablePlayerUpdatePositionContainsKey(kKey) && !EnablePlayerUpdatePosition(kKey))
                    //{
                    //    posX = p.NetworkX;
                    //    posY = p.NetworkY;
                    //    posZ = p.NetworkZ;
                    //}
                    game.GLPushMatrix();
                    game.GLTranslate(posX, posY, posZ);
                    //if (p.Type == PlayerType.Monster)
                    //{
                    //    GLTranslate(0, 1, 0);
                    //}
                    ModDrawSprites.Billboard(game);
                    float scale = game.one * 2 / 100;
                    game.GLScale(scale, scale, scale);

                    //Color c = Color.FromArgb((int)(shadow * 255), (int)(shadow * 255), (int)(shadow * 255));
                    //Todo: Can't change text color because text has outline anyway.
                    if (p.DrawHealth)
                    {
                        game.Draw2dTexture(game.WhiteTexture(), -26, -11, 52, 12, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
                        game.Draw2dTexture(game.WhiteTexture(), -25, -10, 50 * (game.one * p.Health), 10, null, 0, Game.ColorFromArgb(255, 255, 0, 0), false);
                    }
                    FontCi font = new FontCi();
                    font.family = "Arial";
                    font.size = 14;
                    game.Draw2dText(name, font, -game.TextSizeWidth(name, 14) / 2, 0, IntRef.Create(Game.ColorFromArgb(255, 255, 255, 255)), true);
                    //                        GL.Translate(0, 1, 0);
                    game.GLPopMatrix();
                }
            }
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:72,代码来源:DrawPlayerNames.ci.cs


注:本文中的Game.GLPopMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。