コード例 #1
0
ファイル: DemoFont3D.cs プロジェクト: 0000duck/KAOS-Engine
        public DemoFont3D(Demo demo, string fontTextureName, int maxTextLength)
        {
            this.demo     = demo;
            textureHandle = demo.Textures[fontTextureName].Handle;

            fontVertices = new VertexPositionColorTexture[maxTextLength << 2];

            Render = new RenderPCT();

            GL.GenBuffers(1, out fontVertexBuffer);
        }
コード例 #2
0
ファイル: MenuDraw1.cs プロジェクト: 0000duck/KAOS-Engine
        void Draw(DrawMethodArgs args)
        {
            PhysicsScene  scene      = demo.Engine.Factory.PhysicsSceneManager.Get(args.OwnerSceneIndex);
            PhysicsObject objectBase = scene.Factory.PhysicsObjectManager.Get(args.OwnerIndex);

            PhysicsObject physicsObjectWithCamera = scene.GetPhysicsObjectWithCamera(0);

            if (physicsObjectWithCamera == null)
            {
                return;
            }

            PhysicsCamera activeCamera = physicsObjectWithCamera.Camera;

            if (activeCamera == null)
            {
                return;
            }

            float time = args.Time;

            if ((infoScreen == null) || (infoDescription == null))
            {
                return;
            }
            if (!infoDescription.EnableDrawing)
            {
                return;
            }

            string sceneScreenName = infoScreen.Material.UserDataStr;

            if (sceneScreenName == null)
            {
                return;
            }
            if (!demo.Descriptions.ContainsKey(sceneScreenName))
            {
                return;
            }

            List <string> Descriptions = demo.Descriptions[sceneScreenName];

            string info = null;

            infoDescription.MainWorldTransform.GetPosition(ref position);
            activeCamera.View.GetViewMatrix(ref view);
            activeCamera.Projection.GetProjectionMatrix(ref projection);

            RenderPCT render = demo.DemoFont3D.Render;

            render.SetWorld(ref world);
            render.SetView(ref view);
            render.SetProjection(ref projection);

            GL.CullFace(CullFaceMode.Back);

            demo.DemoFont3D.Begin();

            for (int i = 0; i < Descriptions.Count; i++)
            {
                info = Descriptions[i];

                if (info != null)
                {
                    demo.DemoFont3D.Draw(position.X - 25.0f, position.Y + 12.0f - 1.4f * i, position.Z - 0.5f, 0.08125f, 0.12125f, info, whiteColor);
                }
            }

            demo.DemoFont3D.End();
        }