Example #1
0
      public override void LoadContent()
      {
         // Load mesh
         mesh = new SpherePrimitive(0.2f, 50);

         // Load effects
         moonVertexShader = VertexShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/MoonVS.vs", UriKind.Relative)).Stream);
         moonPixelShader = PixelShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/MoonPS.ps", UriKind.Relative)).Stream);

         // Load textures
         moonTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Moon/moon.jpg");
         moonNormalTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Moon/moon_normal.jpg");

         // Set initial state
         depthState = new DepthStencilState
         {
            DepthBufferEnable = true,
            DepthBufferWriteEnable = true,
            DepthBufferFunction = CompareFunction.LessEqual
         };
      }
Example #2
0
      public override void LoadContent()
      {
         // Load mesh
         mesh = new SpherePrimitive(1.5f, 50);

         // Load effects
         sunVertexShader = VertexShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/SunVS.vs", UriKind.Relative)).Stream);
         sunPixelShader = PixelShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/SunPS.ps", UriKind.Relative)).Stream);
         refractionPixelShader = PixelShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/RefractionPS.ps", UriKind.Relative)).Stream);

         // Load textures
         sunTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Sun/Sun.jpg");
         gradientTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Sun/FireGradient.png");
         turbulence1Texture = ContentManager.LoadBitmapAndMipFromResource("Textures/Sun/Turbulence1.png");
         turbulence2Texture = ContentManager.LoadBitmapAndMipFromResource("Textures/Sun/Turbulence2.png");

         depthState = new DepthStencilState
         {
            DepthBufferEnable = true,
            DepthBufferWriteEnable = true,
            DepthBufferFunction = CompareFunction.LessEqual
         };
      }
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {

               

            // Load the model.
            currentModel = Content.Load<Model>("dude");

            // Look up our custom skinning information.
            skinningData = currentModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            boneTransforms = new Matrix[skinningData.BindPose.Count];

            // Load the baseball bat model.
            baseballBat = Content.Load<Model>("baseballbat");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip);

            // Load the bounding spheres.
            skinnedSpheres = Content.Load<SkinnedSphere[]>("CollisionSpheres");
            boundingSpheres = new BoundingSphere[skinnedSpheres.Length];

            spherePrimitive = new SpherePrimitive(GraphicsDevice, 1, 12);

            // Create a new SpriteBatch, which can be used to draw textures.
            napis = new SpriteBatch(GraphicsDevice);
            Font1 = Content.Load<SpriteFont>("napis1");



            this.port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.serialPort1_DataReceived);
            port.Open();   
        }
Example #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("Font");

            sphere = new SpherePrimitive(GraphicsDevice);
            cylinder = new CylinderPrimitive(GraphicsDevice);

            faceEffect = new BasicEffect(GraphicsDevice);
            faceEffect.PreferPerPixelLighting = true;

            vertexEffect = new BasicEffect(GraphicsDevice);
            vertexEffect.EnableDefaultLighting();
            vertexEffect.PreferPerPixelLighting = true;

            edgeEffect = new BasicEffect(GraphicsDevice);
            edgeEffect.EnableDefaultLighting();
            edgeEffect.PreferPerPixelLighting = true;
        }
        protected override void Initialize()
        {
            kinectSensor = new Runtime();
              //  kinectSensor.Initialize(RuntimeOptions.UseColor);
            spriteBatch = new SpriteBatch(GraphicsDevice);
            kinectRGBVideo = new Texture2D(GraphicsDevice, 640, 480);
            cube = new CubePrimitive(graphics.GraphicsDevice);

            cubeXPosition = 5;
            cubeyYPosition = 5;
            cubeTranslation = Matrix.CreateTranslation(cubeXPosition, cubeyYPosition, 5);

            currentPrimitive = new SpherePrimitive(graphics.GraphicsDevice, .25f, 5);

            kinectSensor.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
            kinectSensor.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.ColorYuv);
            kinectSensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(NuiSkeletonFrameReady);
            kinectSensor.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(KinectSensorVideoFrameReady);

            graphics.PreferredBackBufferWidth = 640;
            graphics.PreferredBackBufferHeight = 480;
            graphics.ApplyChanges();

            view = Matrix.CreateLookAt(new Vector3(0, 0, 40), new Vector3(0, 0, -100), Vector3.Up);
            projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                        GraphicsDevice.Viewport.AspectRatio,
                                                        1.0f,
                                                        100);

            base.Initialize();
        }
Example #6
0
      public override void LoadContent()
      {
         // Load mesh
         mesh = new SpherePrimitive(1.0f, 50);

         // Load effects
         earthVertexShader = VertexShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/EarthVS.vs", UriKind.Relative)).Stream);
         earthPixelShader = PixelShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/EarthPS.ps", UriKind.Relative)).Stream);
         atmosphereVertexShader = VertexShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/AtmosphereVS.vs", UriKind.Relative)).Stream);
         cloudsPixelShader = PixelShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/CloudsPS.ps", UriKind.Relative)).Stream);
         lowerAtmospherePixelShader = PixelShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/AtmosphereLowerPS.ps", UriKind.Relative)).Stream);
         upperAtmospherePixelShader = PixelShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/AtmosphereUpperPS.ps", UriKind.Relative)).Stream);
         upperAtmosphereVertexShader = VertexShader.FromStream(GraphicsDeviceManager.Current.GraphicsDevice, Application.GetResourceStream(new Uri(@"/SLARToolKit3DSample;component/Shaders/AtmosphereUpperVS.vs", UriKind.Relative)).Stream);

         // Load textures
         atmosphereTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Earth/EarthAtmosphere.png");
         cloudTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Earth/EarthClouds.png");
         dayTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Earth/EarthDay.jpg");
         maskTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Earth/EarthMask.png");
         nightTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Earth/EarthNight.png");
         nightLightsTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Earth/EarthNightLights.png");
         normalTexture = ContentManager.LoadBitmapAndMipFromResource("Textures/Earth/EarthNormal.jpg");

         // Set initial state
         depthState = new DepthStencilState
         {
            DepthBufferEnable = true,
            DepthBufferWriteEnable = true,
            DepthBufferFunction = CompareFunction.LessEqual
         };

         cloudBlendState = new BlendState()
         {
            ColorSourceBlend = Blend.SourceAlpha,
            AlphaSourceBlend = Blend.SourceAlpha,
            ColorDestinationBlend = Blend.One,
            AlphaDestinationBlend = Blend.One
         };

         atmosphereBlendState = new BlendState()
         {
            ColorSourceBlend = Blend.SourceAlpha,
            AlphaSourceBlend = Blend.SourceAlpha,
            ColorDestinationBlend = Blend.One,
            AlphaDestinationBlend = Blend.One
         };

         // Load Moon data 
         Moon.LoadContent();
      }