Inheritance: IBindable, IDisposable
Exemple #1
0
        public ConferenceRoom(GraphicsInterface gi, Vector3D roomSize)
            : base(gi, roomSize, new Vector3D(0, roomSize.Y / 2.0f, 0), new Resolution(10, 10))
        {


            fWallTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Wall.tiff", false);
            fCeilingTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Ceiling.tiff", false);
            fFloorTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Carpet_berber_dirt.jpg", false);

            fChildren = new List<IRenderable>();

            SetWallTexture(AABBFace.Ceiling, fCeilingTexture);
            SetWallTexture(AABBFace.Floor, fFloorTexture);

            SetWallTexture(AABBFace.Front, fWallTexture);
            SetWallTexture(AABBFace.Back, fWallTexture);
            SetWallTexture(AABBFace.Left, fWallTexture);
            SetWallTexture(AABBFace.Right, fWallTexture);

            Vector3D wbSize = new Vector3D(4.0f-(0.305f*2.0f), 3.0f, 0.01f);
            Point3D wbTrans = new Point3D(0, (wbSize.Y/2)+(roomSize.Y-wbSize.Y)/2, -roomSize.Z / 2.0f+.02f);
            AABB wbBB = new AABB(wbSize, wbTrans);
            whiteboard = new Whiteboard(gi, wbBB);
            //whiteboard.ImageSource = localCamProjector;
            
            fTable = new PedestalTable(gi);

            
            
            fChildren.Add(whiteboard);
            fChildren.Add(fTable);
        }
Exemple #2
0
        public Cube(GraphicsInterface gi, Vector3D size, GLTexture texture)
            :base(gi, BeginMode.Quads)
        {
            fSize = size;
            Texture = texture;

            CreateMesh();
        }
        /// <summary>
        /// To construct a mesh, we need to know the size and resolution.  
        /// We also set the texture as a convenience.
        /// </summary>
        /// <param name="boundary">The size on the XY plane.  The value is not used.</param>
        /// <param name="res">The resolution determines how many rows and columns of quads will be generated.</param>
        /// <param name="texture">An optional texture object to be bound to the mesh.
        /// Normalized texture coordinates will be generated whether a texture object is assigned or not.</param>
        public XYAxesPointMesh(GraphicsInterface gi, Vector3D boundary, Resolution res, GLTexture texture)
            : base(gi, BeginMode.Points)
        {
            fSize = boundary;
            fResolution = res;
            Texture = texture;

            CreateMesh();
        }
Exemple #4
0
        public void SetupTexture()
        {
            //fCamera1 = VideoTexture.CreateFromDeviceIndex(GI, 0, 320, 240);
            //fCamera2 = VideoTexture.CreateFromDeviceIndex(GI, 1, 320, 240);
            fCamera1 = VideoTexture.CreateFromDeviceIndex(GI, 0, true);
            fCamera2 = VideoTexture.CreateFromDeviceIndex(GI, 1, true); 
            fPictureTexture = TextureHelper.CreateTextureFromFile(GI, "EELogo.jpg", false);

            flagTexture = fPictureTexture;
        }
Exemple #5
0
        protected override void OnSetContext()
        {
            fSmallStars = new StarField2D(GI, SMALL_STARS, 7.0f, new Vector2i(SCREEN_X, SCREEN_Y));
            fMediumStars = new StarField2D(GI, MEDIUM_STARS, 12.0f, new Vector2i(SCREEN_X * 10, SCREEN_Y));
            fLargeStars = new StarField2D(GI, LARGE_STARS, 20.0f, new Vector2i(SCREEN_X * 10, SCREEN_Y));

            // Load moon texture
            GLPixelData pBytes;
            pBytes = TargaHandler.CreatePixelDataFromFile("moon.tga");
            fMoonTexture = new GLTexture(GI, pBytes, true);
        }
        protected override void OnSetContext()
        {
            GraphicsInterface.gCheckErrors = true;

            GI.Features.DepthTest.Enable();

            // Medium Cyan background
            GI.Buffers.ColorBuffer.Color = ColorRGBA.MediumCyan;

            // Cull backs of polygons
            //GI.CullFace(GLFace.Back);
            GI.FrontFace(FrontFaceDirection.Ccw);
            //GI.Enable(GLOption.CullFace);

            GI.Features.DepthTest.Enable();

            SetupLighting();

            // Mostly use material tracking
            GI.Features.ColorMaterial.Enable();
            GI.ColorMaterial(GLFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse);
            GI.Material(GLFace.FrontAndBack, MaterialParameter.Shininess, 128);


            string PanoramicName = "Microsoft RoundTable Panoramic Video";
            string SpeakerName = "Microsoft RoundTable Active Speaker Video";

            fWallTexture = VideoTexture.CreateFromDevicePath(GI, PanoramicName, -1, -1, true);
            if (null == fWallTexture)
            {
                fWallTexture = TextureHelper.CreateCheckerboardTexture(GI, 512, 512, 16);
            }
            else
            {
                ((VideoTexture)fWallTexture).Start();
            }

            fCubeTexture = VideoTexture.CreateFromDevicePath(GI, SpeakerName, -1, -1, true);
            if (fCubeTexture == null)
            {
                fCubeTexture = VideoTexture.CreateFromDeviceIndex(GI, 0, true);
                if (fCubeTexture == null)
                {
                    fCubeTexture = TextureHelper.CreateCheckerboardTexture(GI, 512, 512, 8);
                }
            }
            else
            {
                ((VideoTexture)fCubeTexture).Start();
            }

            fWallCylinder = new WallCylinder(GI, fWallTexture, fExpansionFactor);
            fSpeakerCube = new SpeakerCube(GI, fCubeTexture);
        }
        public TexturedCheckerboard(Size pixelSize, Size blockSize, GLTexture tex1, GLTexture tex2)
        {
            Translation = new Vector3f();
            Rotation = new Vector3f();

            PixelSize = pixelSize;
            BlockSize = blockSize;

            fTexture1 = tex1;
            fTexture2 = tex2;
        }
Exemple #8
0
        public SpeakerCube(GraphicsInterface gi, GLTexture faceTexture)
            :base(gi, faceTexture, 4, 4.0f, 4.0f, 10, 10, 1.0f)
        {
            Translation = new float3(0, 4.0f, 0.0);
            fSpeakerSeparation = 0.30f;

            // Sections displaying current speaker
            fSpeakerSection0 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);
            fSpeakerSection90 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);
            fSpeakerSection180 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);
            fSpeakerSection270 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);
        }
Exemple #9
0
        /// <summary>
        /// Construct a cube of the given size.  Initially, the cube starts as a
        /// unit cube, being 1 unit in all directions, with its center located 
        /// at the origin (0,0,0).  The scaling is applied, then the translation.
        /// This way, you can specify a solid rectangular volume of any dimension
        /// and put it anywhere in the scene.
        /// </summary>
        /// <param name="scale">A vector describing the scale</param>
        /// <param name="translation">A vector describing the translation</param>
        public AABBSurface(GraphicsInterface gi, Vector3D roomSize, Vector3D translation, Resolution res)
        {
            GI = gi;
            fAxes = new GLAxes(roomSize.Y);

            // Setup scale and translation
            fRoomSize = roomSize;
            fTranslation = translation;
            fResolution = res;
            fDefaultTexture = TextureHelper.CreateCheckerboardTexture(gi, 256, 256, 16);

            // Create the six walls of the room
            fWalls = new Dictionary<AABBFace, AABBFaceMesh>(6);
            AddWalls();
        }
Exemple #10
0
        public MasterCylinder(GraphicsInterface gi, GLTexture texture, int numberOfSections, float radius, float height, int stacks, int slices, float expanseFactor)
        {
            GI = gi;
            CylinderTexture = texture;

            NumberOfSections = numberOfSections;
            Radius = radius;
            Height = height;
            Stacks = stacks;
            Slices = slices;
            ArcDegrees = 360 / numberOfSections;
            ExpansionFactor = expanseFactor;

            ConstructSections();
        }
Exemple #11
0
        public GLTexture ForwardDCT(GLTexture sourceImage)
        {
            if (null == sourceImage)
                return null;

            // First, create an array of points that divide
            // the texture into 8x8 chunks

            // We require 4 passes of drawing to actually get
            // all the output values, so perform each of those
            // passes, changing the quadrant each time.
            // Use a quadrant specific shader program for each pass
            // pass1
            // pass2
            // pass3
            // pass4

            // At this point, the full DCT should be contained in the output
            // image, so we can just return it.
            return fDCTOutputTexture;
        }
Exemple #12
0
        protected override void OnSetContext()
        {
            fSepiaProgram = GLSLShaderProgram.CreateUsingVertexAndFragmentStrings(GI, null, Shaders.ShaderStrings.sepia_fs);

            int numSources = VideoCaptureDevice.GetNumberOfInputDevices();

            if (numSources > 0)
            {
                fVideoTexture1 = VideoTexture.CreateFromDeviceIndex(GI, 0, true);
            }
            else
                fVideoTexture1 = TextureHelper.CreateCheckerboardTexture(GI, 320, 240, 8);
            fVideoTexture1.Unbind();

            if (numSources > 1)
            {
                fVideoTexture2 = VideoTexture.CreateFromDeviceIndex(GI, 1, true);
            }
            else
                fVideoTexture2 = TextureHelper.CreateCheckerboardTexture(GI, 320, 240, 16);
            fVideoTexture2.Unbind();

            //if (numSources > 2)
            //{
            //    fVideoTexture2 = VideoTexture.CreateFromDeviceIndex(GI, 2, true);
            //}

            fCheckerboard = new TexturedCheckerboard(new Size(fViewportWidth, fViewportHeight),
                new Size(fHowManySplits, fHowManySplits), fVideoTexture1, fVideoTexture2);

            // Turn off features that we don't need
            // they just slow down video processing
            GI.Features.AlphaTest.Disable();
            GI.Features.Blend.Disable();
            GI.Features.DepthTest.Disable();
            GI.Features.Dither.Disable();
            GI.Features.Fog.Disable();
            GI.Features.Lighting.Disable();
        }
Exemple #13
0
        void DrawSpeakerCube()
        {
            GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMinFilter.Linear);
            GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMagFilter, TextureMagFilter.Linear);
            GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureWrapS, TextureWrapMode.Clamp);
            GI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureWrapT, TextureWrapMode.Clamp);
            GI.TexEnv(TextureEnvModeParam.Modulate);
            GI.Features.Texturing2D.Enable();

            // Set drawing color to white
            //GI.Drawing.Color = ColorRGBA.White;
            //GI.FrontFace(FrontFaceDirection.Cw);

            if (null != fViewer && fViewer.TexTure != null)
                fDesktopTexture = fViewer.TexTure;


            GI.PolygonMode(GLFace.Front, PolygonMode.Fill);

            // Draw Section 0
            fDesktopTexture.Bind();
            GI.PushMatrix();
                GI.Rotate(0, 0, 1, 0);
                GI.Translate(0, 4, fSpeakerSection0.Radius * fSpeakerSeparation);
                fSpeakerSection0.Render(GI);
            GI.PopMatrix();
            fDesktopTexture.Unbind();

            // Draw Section 90
                fSpeakerTexture.Bind();
            GI.PushMatrix();
                GI.Rotate(90, 0, 1, 0);
                GI.Translate(0, 4, fSpeakerSection90.Radius * fSpeakerSeparation);
                fSpeakerSection90.Render(GI);
            GI.PopMatrix();
                fSpeakerTexture.Unbind();

            // Draw Section 180
            fDesktopTexture.Bind();
            GI.PushMatrix();
                GI.Rotate(180, 0, 1, 0);
                GI.Translate(0, 4, fSpeakerSection180.Radius * fSpeakerSeparation);
                fSpeakerSection180.Render(GI);
            GI.PopMatrix();
            fDesktopTexture.Unbind();

            // Draw Section 270
                fSpeakerTexture.Bind();
            GI.PushMatrix();
                GI.Rotate(270, 0, 1, 0);
                GI.Translate(0, 4, fSpeakerSection270.Radius * fSpeakerSeparation);
                fSpeakerSection270.Render(GI);
            GI.PopMatrix();
                fSpeakerTexture.Unbind();
        }
Exemple #14
0
 protected override void OnSetContext()
 {
     //fTexture = new GLTexture(CHECKIMAGEWIDTH, CHECKIMAGEHEIGHT);
     if (fTexture == null)
         fTexture = TextureHelper.CreateCheckerboardTexture(GI, CHECKIMAGEWIDTH, CHECKIMAGEHEIGHT, CHECKIMAGEBLOCKSIZE);
 }
 public virtual void ProjectTexture(GLTexture texture)
 {
     fSurface.SetWallTexture(AABBFace.Front, texture);
     fSurface.SetWallTexture(AABBFace.Back, texture);
 }
Exemple #16
0
        protected override void  OnSetContext()
        {
            // When debugging, it's nice to turn on the following check.
            // If you do, whenever there is an error while calling one of the 
            // underlying OpenGL functions, a GLException will be thrown.
            // If this flag is not set, then errors will be silently passed by and
            // rendering will continue.
            //GraphicsInterface.gCheckErrors = true;



            // Enable a couple of features for nice rendering.
            // For this program, Texturing, and DepthTest are essential.
            // The hint for perspective correction is optional
            GI.Features.Texturing2D.Enable();
            GI.Features.DepthTest.Enable();
            GI.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);

            // Set an overall color buffer background color of Invisible,
            // so when we clear the color buffer, it starts out blank.
            GI.Buffers.ColorBuffer.Color = ColorRGBA.Invisible;

            // Create the offscreen render target
            fRenderTarget = new GLRenderTarget(GI, fOffscreenWidth, fOffscreenHeight);

            // Create the texture object that we will be using to do normal rendering.
            // 
            aTexture = TextureHelper.CreateTextureFromFile(GI, "tex.png", false);

            // Create the shader programs using the easy static method that
            // takes vertex and fragment shader strings.
            fFixedPipeline = GLSLShaderProgram.CreateUsingVertexAndFragmentStrings(GI, ShaderStrings.FixedVert, ShaderStrings.FixedFrag);
            fImageProcProgram = GLSLShaderProgram.CreateUsingVertexAndFragmentStrings(GI, ShaderStrings.FixedVert, ShaderStrings.ConvolutionFrag);

            // This is an alternate method of creating the shader programs.
            // You get absolute control of the individual pieces as they 
            // are created, at the cost of brevity
            //GLSLVertexShader fixedVertexShader = new GLSLVertexShader(GI, ShaderStrings.FixedVert);
            //GLSLFragmentShader fixedFragmentShader = new GLSLFragmentShader(GI, ShaderStrings.FixedFrag);
            //GLSLFragmentShader convolutionFragmentShader = new GLSLFragmentShader(GI, ShaderStrings.ConvolutionFrag);

            //// Create the pipeline shader program
            //fFixedPipeline = new GLSLShaderProgram(GI);
            //fFixedPipeline.AttachShader(fixedVertexShader);
            //fFixedPipeline.AttachShader(fixedFragmentShader);
            //fFixedPipeline.Link();

            //// Create the convolution shader program
            //fImageProcProgram = new GLSLShaderProgram(GI);
            //fImageProcProgram.AttachShader(fixedVertexShader);
            //fImageProcProgram.AttachShader(convolutionFragmentShader);
            //fImageProcProgram.Link();

        }
Exemple #17
0
 public WallCylinder(GraphicsInterface gi, GLTexture wallTexture, float expanseFactor)
     :base(gi, wallTexture, 5, 14.0f, 12.0f, 10, 10, expanseFactor)
 {
 }
Exemple #18
0
        /// <summary>
        /// Create a mesh object that represents the wall.
        /// 
        /// </summary>
        /// <param name="roomSize">The size of the room</param>
        /// <param name="whichWall">Which wall of the room are we creating</param>
        /// <param name="res">The Resolution of the mesh, meaning, the number of rows and columns of quads to create.</param>
        /// <returns>The mesh3D object representing the wall</returns>
        public static AABBFaceMesh CreateFace(GraphicsInterface gi, Vector3D roomSize, AABBFace whichWall, Resolution res, GLTexture texture)
        {
            AABBFaceMesh wall = new AABBFaceMesh(gi, roomSize, whichWall);

            Vector3f[] vertices = new Vector3f[(res.Columns)*(res.Rows)*4];
            TextureCoordinates[] texCoords = new TextureCoordinates[(res.Columns) * (res.Rows)*4];
            int[] indices = new int[res.Columns * res.Rows * 4];

            
            // The general routine is to create a mesh in the x-y plane, using
            // the appropriate width and height.
            // Then take this mesh and rotate and translate it into the right position
            // after it is created.

            // First calculate the min/max values in the x-y plane
            float minX=0.0f;
            float maxX=0.0f;
            
            float minY=0.0f;
            float maxY=0.0f;

            switch (whichWall)
            {
                case AABBFace.Front:
                case AABBFace.Back:
                    minX = roomSize.X / -2;
                    maxX = roomSize.X / 2;

                    minY = roomSize.Y / -2;
                    maxY = roomSize.Y / 2;
                    break;

                case AABBFace.Left:
                case AABBFace.Right:
                    minX = roomSize.Z / -2;
                    maxX = roomSize.Z / 2;

                    minY = roomSize.Y / -2;
                    maxY = roomSize.Y / 2;
                    break;

                case AABBFace.Ceiling:
                case AABBFace.Floor:
                    minX = roomSize.X / -2;
                    maxX = roomSize.X / 2;

                    minY = roomSize.Z / -2;
                    maxY = roomSize.Z / 2;
                    break;
            }

            // Now that we have the min/max sizes in the x-y plane
            // Construct the quad vertices based on the resolution.  
            // Start from the bottom (negative y) and go up
            // Move from left (negative x) to right
            float xDiff = maxX - minX;
            float yDiff = maxY - minY;
            float xIncr = xDiff / res.Columns;
            float yIncr = yDiff / res.Rows;
            int vIndex = 0;

            for (int row = 0; row < res.Rows; row++)
            {
                for (int column = 0; column < res.Columns; column++)
                {
                    Vector3f vertex1 = new Vector3f(minX + column * xIncr, minY + row * yIncr, 0);
                    Vector3f vertex2 = new Vector3f(minX + (column + 1) * xIncr, minY + row * yIncr, 0);
                    Vector3f vertex3 = new Vector3f(minX + (column + 1) * xIncr, minY + (row + 1) * yIncr, 0);
                    Vector3f vertex4 = new Vector3f(minX + column * xIncr, minY + (row + 1) * yIncr, 0);

                    // Set the vertices for the quad
                    vertices[vIndex + 0] = vertex1;
                    vertices[vIndex + 1] = vertex2;
                    vertices[vIndex + 2] = vertex3;
                    vertices[vIndex + 3] = vertex4;

                    // Set the indices for the quad
                    indices[vIndex + 0] = vIndex;
                    indices[vIndex + 1] = vIndex + 1;
                    indices[vIndex + 2] = vIndex + 2;
                    indices[vIndex + 3] = vIndex + 3;

                    // Set the texture coords for the quad
                    texCoords[vIndex + 0].Set(0.0f, 0.0f);
                    texCoords[vIndex + 1].Set(1.0f, 0.0f);
                    texCoords[vIndex + 2].Set(1.0f, 1.0f);
                    texCoords[vIndex + 3].Set(0.0f, 1.0f);

                    vIndex += 4;
                }
            }

            // assign all the attributes to the mesh object
            // and return it.
            wall.SetIndices(indices);
            wall.SetVertices(vertices);
            wall.SetTextureCoordinates(texCoords);
            wall.Texture = texture;

            
            // Now transform the vertices based on which wall it is we are constructing
            minX = roomSize.X / -2;
            maxX = roomSize.X / 2;

            minY = roomSize.Y / -2;
            maxY = roomSize.Y / 2;

            float minZ = roomSize.Z / -2;
            float maxZ = roomSize.Z / 2;
            Transformation transform = new Transformation();

            switch (whichWall)
            {
                case AABBFace.Front:
                    transform.Translate(new float3(0, 0, minZ));
                    break;

                case AABBFace.Back:
                    transform.SetRotate(float3x3.Rotate((float)Math.PI, new float3(0, 1, 0)));
                    transform.Translate(new float3(0, 0, maxZ));
                    break;

                case AABBFace.Left:
                    transform.SetRotate(float3x3.Rotate((float)Math.PI/2, new float3(0, 1, 0)));
                    transform.Translate(new float3(minX, 0, 0));

                    break;

                case AABBFace.Right:
                    transform.SetRotate(float3x3.Rotate((float)-Math.PI/2, new float3(0, 1, 0)));
                    transform.Translate(new float3(maxX, 0, 0));
                    break;

                case AABBFace.Ceiling:
                    transform.SetRotate(float3x3.Rotate((float)-Math.PI/2, new float3(1, 0, 0)));
                    transform.Translate(new float3(0, maxY, 0));
                    break;

                case AABBFace.Floor:
                    transform.SetRotate(float3x3.Rotate((float)Math.PI/2, new float3(1, 0, 0)));
                    transform.Translate(new float3(0, minY, 0));
                    break;
            }

            wall.ApplyTransform(transform);


            return wall;
        }
Exemple #19
0
        public override IntPtr OnKeyboardActivity(object sender, KeyboardActivityArgs kbde)
        {
            if (kbde.AcitivityType == KeyActivityType.KeyDown)
            {
                switch (kbde.VirtualKeyCode)
                {
                    case VirtualKeyCodes.Left:
                    case VirtualKeyCodes.A:
                        angRotY += 1.0f;
                        break;

                    case VirtualKeyCodes.Right:
                    case VirtualKeyCodes.S:
                        angRotY -= 1.0f;
                        break;

                    case VirtualKeyCodes.Up:
                        windStrength += 0.1;
                        break;

                    case VirtualKeyCodes.Down:
                        windStrength -= 0.1;
                        break;
                }
            }

            if (kbde.AcitivityType == KeyActivityType.KeyUp)
            {
                switch (kbde.VirtualKeyCode)
                {
                    case VirtualKeyCodes.F1:
                        flagTexture = fPictureTexture;
                        break;

                    case VirtualKeyCodes.F2:
                        flagTexture = fCamera1;
                        break;

                    case VirtualKeyCodes.F3:
                        flagTexture = fCamera2;
                        break;

                    case VirtualKeyCodes.F:
                        polyFillMode = PolygonMode.Fill;
                        break;
                    case VirtualKeyCodes.L:
                        polyFillMode = PolygonMode.Line;
                        break;
                    case VirtualKeyCodes.W:
                        fBanner.ApplyWind = !fBanner.ApplyWind;
                        break;
                    case VirtualKeyCodes.T:
                        bUseTexture = !bUseTexture;
                        break;
                }
            }

            return IntPtr.Zero;
        }
Exemple #20
0
    public void SetupTexture()
    {
        //fPictureTexture = TextureHelper.CreateTextureFromFile(GI, "bara.gif", false);
        fPictureTexture = TextureHelper.CreateTextureFromFile(GI, "EELogo.jpg", false);
        //fPictureTexture = TextureHelper.CreateTextureFromFile(GI, "EEIndia.jpg", false);

        flagTexture = fPictureTexture;
    }
Exemple #21
0
        public void SetWallTexture(AABBFace whichWall, GLTexture texture)
        {
            AABBFaceMesh wall = GetWall(whichWall);
            if (null == wall)
                return;

            wall.Texture = texture;
        }
Exemple #22
0
        protected override void  OnSetContext()
        {
            GraphicsInterface.gCheckErrors = true;

            //fViewer = new SketchViewer(GI, 620, 440);

            
            // Sections of the wall
            fSection0 = new CylinderSection(GI, 14.0f, 12.0f, 72, 10, 10, new RectangleF(4.0f/5,1, 1.0f/5, 1));

            fSection72 = new CylinderSection(GI, 14.0f, 12.0f, 72, 10, 10, new RectangleF(3.0f/5, 1, 1.0f / 5, 1));

            fSection144 = new CylinderSection(GI, 14.0f, 12.0f, 72, 10, 10, new RectangleF(2.0f / 5, 1, 1.0f / 5, 1));

            fSection216 = new CylinderSection(GI, 14.0f, 12.0f, 72, 10, 10, new RectangleF(1.0f / 5, 1, 1.0f / 5, 1));

            fSection288 = new CylinderSection(GI, 14.0f, 12.0f, 72, 10, 10, new RectangleF(0.0f / 5, 1, 1.0f / 5, 1));


            // Sections displaying current speaker
            fSpeakerSection0 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);
            fSpeakerSection90 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);
            fSpeakerSection180 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);
            fSpeakerSection270 = new CylinderSection(GI, 4.0f, 4.0f, 45, 10, 10);



            GI.Features.DepthTest.Enable();

            // Medium Cyan background
            GI.Buffers.ColorBuffer.Color = ColorRGBA.MediumCyan;

            // Cull backs of polygons
            //GI.CullFace(GLFace.Back);
            GI.FrontFace(FrontFaceDirection.Ccw);
            //GI.Enable(GLOption.CullFace);

            GI.Features.DepthTest.Enable();

            // Setup light parameters
            //GI.LightModel(LightModelParameter.LightModelAmbient, fNoLight);
            GI.LightModel(LightModelParameter.LightModelAmbient, fBrightLight);
            GI.Features.Lighting.Light0.Ambient = new ColorRGBA(fLowLight);
            GI.Features.Lighting.Light0.Diffuse = new ColorRGBA(fBrightLight);
            GI.Features.Lighting.Light0.Specular = new ColorRGBA(fBrightLight);
            GI.Features.Lighting.Enable();
            GI.Features.Lighting.Light0.Enable();

            // Mostly use material tracking
            GI.Features.ColorMaterial.Enable();
            GI.ColorMaterial(GLFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse);
            GI.Material(GLFace.FrontAndBack, MaterialParameter.Shininess, 128);


            string PanoramicName = "Microsoft RoundTable Panoramic Video";
            string SpeakerName = "Microsoft RoundTable Active Speaker Video";

            //fWallTexture = TextureHelper.CreateCheckerboardTexture(GI, 512, 512);
            //fWallTexture = VideoTexture.CreateVideoDeviceTexture(GI, PanoramicName);
            fWallVideo = VideoTexture.CreateFromDeviceIndex(GI, 0);
            fWallTexture = fWallVideo;


            //fSpeakerTexture = TextureHelper.CreateCheckerboardTexture(GI, 512, 512);
            //fSpeakerTexture = VideoTexture.CreateVideoDeviceTexture(GI, SpeakerName);
            //fSpeakerTexture = VideoTexture.CreateFromDeviceIndex(GI, 1);
            fSpeakerVideo = VideoTexture.CreateFromDeviceIndex(GI, 1);
            fSpeakerTexture = fSpeakerVideo;

            fDesktopTexture = TextureHelper.CreateCheckerboardTexture(GI, 512, 512);
        }
Exemple #23
0
        /// <summary>
        /// This routine uses the YCrCbProcessor object to do the actual work of color
        /// model conversion.  After the processing occurs, we are left with three
        /// different texture objects as properties on the processor.
        /// 
        /// We assign those properties to variables that are used to display the results.
        /// </summary>
        void SeparateChannels()
        {
            fYCrCbProcessor.SeparateChannels(fVideoTexture);

            // Assign resultant textures to variables
            fYTexture = fYCrCbProcessor.YChannel;
            fCrTexture = fYCrCbProcessor.CrChannel;
            fCbTexture = fYCrCbProcessor.CbChannel;

            // assign the texture on the mesh object
            fFaceMesh.Texture = fYTexture;
        }
Exemple #24
0
        /// <summary>
        /// This routine is meant to draw a quad with the specified texture
        /// on the screen.  It achieves this by first changing the viewport to 
        /// match the coordinates specified in the destination rectangle.
        /// 
        /// The coordinate system starts with 0,0 being the lower left hand
        /// corner of the window, and increasing x to the right and y as you
        /// go up the screen.  The coordinates are in pixels.
        /// 
        /// This can draw a "screen aligned quad" if the x,y == 0,0, and the
        /// width,height == the size of the frame buffer being drawn into.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="x">location of x coordinate</param>
        /// <param name="y">location of y coordinate</param>
        /// <param name="width">width in pixels of the viewport</param>
        /// <param name="height">height in pixels of the viewport</param>
        void DisplayQuad(GLTexture texture, RectangleF srcRect, Rectangle dstRect)
        {
            int left = dstRect.X;
            int bottom = dstRect.Y;
            int right = left + dstRect.Width;
            int top = bottom + dstRect.Height;

            GI.Viewport(left, bottom, dstRect.Width, dstRect.Height);
            GI.MatrixMode(MatrixMode.Projection);
            GI.LoadIdentity();

            GI.Ortho(0, dstRect.Width, 0, dstRect.Height, -1.0, 1.0);



            texture.Bind();
            GI.FrontFace(FrontFaceDirection.Ccw);

            GI.Drawing.Quads.Begin();
            {
                // Left bottom
                GI.TexCoord(srcRect.X, srcRect.Y);
                GI.Vertex(0, 0);

                // Right bottom
                GI.TexCoord(srcRect.X + srcRect.Width, srcRect.Y);
                GI.Vertex(dstRect.Width, 0);

                // Right top
                GI.TexCoord(srcRect.X + srcRect.Width, srcRect.Y + srcRect.Height);
                GI.Vertex(dstRect.Width, dstRect.Height);

                // Left top
                GI.TexCoord(srcRect.X, srcRect.Y + srcRect.Height);
                GI.Vertex(0, dstRect.Height);
            }
            GI.Drawing.Quads.End();

            texture.Unbind();
        }