예제 #1
0
        public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture, int roundDecimals)
        {
            var numSides = (int)_numSides.GetValue();
            if (numSides < 3) yield break;

            var width = box.Width;
            var length = box.Length;
            var height = box.Height;
            var major = width / 2;
            var minor = length / 2;
            var heightRadius = height / 2;

            var angleV = DMath.DegreesToRadians(180) / numSides;
            var angleH = DMath.DegreesToRadians(360) / numSides;

            var faces = new List<Coordinate[]>();
            var bottom = new Coordinate(box.Center.X, box.Center.Y, box.Start.Z).Round(roundDecimals);
            var top = new Coordinate(box.Center.X, box.Center.Y, box.End.Z).Round(roundDecimals);

            for (var i = 0; i < numSides; i++)
            {
                // Top -> bottom
                var zAngleStart = angleV * i;
                var zAngleEnd = angleV * (i + 1);
                var zStart = heightRadius * DMath.Cos(zAngleStart);
                var zEnd = heightRadius * DMath.Cos(zAngleEnd);
                var zMultStart = DMath.Sin(zAngleStart);
                var zMultEnd = DMath.Sin(zAngleEnd);
                for (var j = 0; j < numSides; j++)
                {
                    // Go around the circle in X/Y
                    var xyAngleStart = angleH * j;
                    var xyAngleEnd = angleH * ((j + 1) % numSides);
                    var xyStartX = major * DMath.Cos(xyAngleStart);
                    var xyStartY = minor * DMath.Sin(xyAngleStart);
                    var xyEndX = major * DMath.Cos(xyAngleEnd);
                    var xyEndY = minor * DMath.Sin(xyAngleEnd);
                    var one = (new Coordinate(xyStartX * zMultStart, xyStartY * zMultStart, zStart) + box.Center).Round(roundDecimals);
                    var two = (new Coordinate(xyEndX * zMultStart, xyEndY * zMultStart, zStart) + box.Center).Round(roundDecimals);
                    var three = (new Coordinate(xyEndX * zMultEnd, xyEndY * zMultEnd, zEnd) + box.Center).Round(roundDecimals);
                    var four = (new Coordinate(xyStartX * zMultEnd, xyStartY * zMultEnd, zEnd) + box.Center).Round(roundDecimals);
                    if (i == 0)
                    {
                        // Top faces are triangles
                        faces.Add(new[] { top, three, four });
                    }
                    else if (i == numSides - 1)
                    {
                        // Bottom faces are also triangles
                        faces.Add(new[] { bottom, one, two });
                    }
                    else
                    {
                        // Inner faces are quads
                        faces.Add(new[] { one, two, three, four });
                    }
                }
            }
            yield return MakeSolid(generator, faces, texture, Colour.GetRandomBrushColour());
        }
 public DiffuseMaterial(ShaderProgram shaderProgram, string texturepath)
 {
     sp = shaderProgram;
     Textureparam = sp.GetShaderParam("texture1");
     ImageData Image = SceneManager.RC.LoadImage(texturepath);
     Tex = SceneManager.RC.CreateTexture(Image);
 }
예제 #3
0
 public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture)
 {
     var solid = new Solid(generator.GetNextObjectID()) { Colour = Colour.GetRandomBrushColour() };
     // The lower Z plane will be base, the x planes will be triangles
     var c1 = new Coordinate(box.Start.X, box.Start.Y, box.Start.Z);
     var c2 = new Coordinate(box.End.X, box.Start.Y, box.Start.Z);
     var c3 = new Coordinate(box.End.X, box.End.Y, box.Start.Z);
     var c4 = new Coordinate(box.Start.X, box.End.Y, box.Start.Z);
     var c5 = new Coordinate(box.Center.X, box.Start.Y, box.End.Z);
     var c6 = new Coordinate(box.Center.X, box.End.Y, box.End.Z);
     var faces = new[]
                     {
                         new[] { c1, c2, c3, c4 },
                         new[] { c2, c1, c5 },
                         new[] { c5, c6, c3, c2 },
                         new[] { c4, c3, c6 },
                         new[] { c6, c5, c1, c4 }
                     };
     foreach (var arr in faces)
     {
         var face = new Face(generator.GetNextFaceID())
                        {
                            Parent = solid,
                            Plane = new Plane(arr[0], arr[1], arr[2]),
                            Colour = solid.Colour,
                            Texture = { Texture = texture }
                        };
         face.Vertices.AddRange(arr.Select(x => new Vertex(x, face)));
         face.UpdateBoundingBox();
         face.AlignTextureToFace();
         solid.Faces.Add(face);
     }
     solid.UpdateBoundingBox();
     yield return solid;
 }
예제 #4
0
 public void SetValue(string name, ITexture t)
 {
     var texture = (Texture)t;
     var param = Tao.Cg.Cg.cgGetNamedEffectParameter(effect, name);
     if (param != IntPtr.Zero && texture != null)
         Tao.Cg.CgGl.cgGLSetupSampler(param, texture.texture);
 }
예제 #5
0
        public static void Bump(ITexture<double> d, DifferentialGeometry dgGeom, DifferentialGeometry dgShading, ref DifferentialGeometry dgBump)
        {
            DifferentialGeometry dgEval = new DifferentialGeometry (dgShading);

            double du = 0.5 * (Math.Abs (dgShading.dudx) + Math.Abs (dgShading.dudy));
            if (du == 0.0)
                du = 0.01;
            dgEval.p = dgShading.p + du * dgShading.dpdu;
            dgEval.u = dgShading.u + du;
            dgEval.n = (new Normal(dgShading.dpdu % dgShading.dpdv) + du * dgShading.dndu).Normalized;

            double uDisplace = d.Evaluate (dgEval);

            double dv = 0.5 * (Math.Abs (dgShading.dvdx) + Math.Abs (dgShading.dvdy));
            if (dv == 0.0)
                dv = 0.01;
            dgEval.p = dgShading.p + dv * dgShading.dpdv;
            dgEval.u = dgShading.u;
            dgEval.v = dgShading.v + dv;
            dgEval.n = (new Normal(dgShading.dpdu % dgShading.dpdv) + dv * dgShading.dndv).Normalized;

            double vDisplace = d.Evaluate (dgEval);
            double displace = d.Evaluate (dgShading);

            dgBump = new DifferentialGeometry (dgShading);
            dgBump.dpdu = dgShading.dpdu + (uDisplace - displace) / du * new Vector (dgShading.n) + displace * new Vector (dgShading.dndu);
            dgBump.dpdv = dgShading.dpdv + (vDisplace - displace) / dv * new Vector (dgShading.n) + displace * new Vector (dgShading.dndv);
            dgBump.n = new Normal((dgBump.dpdu % dgBump.dpdv).Normalized);

            if (dgShading.Shape.ReverseOrientation ^ dgShading.Shape.TransformSwapsHandedness)
                dgBump.n *= -1.0;

            dgBump.n = Util.FaceForward (dgBump.n, dgGeom.n);
        }
예제 #6
0
        public bool LoadTexture(ThW.Render.Textures.Texture texture, ITexture noTexture)
        {
            Texture2D texture2d = this.contentManager.Load<Texture2D>(texture.Name);
            texture.UpdateTexture(texture2d, TextureState.Loaded, texture2d.Width, texture2d.Height);

            return true;
        }
예제 #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="samplerState"></param>
        /// <param name="location"></param>
        /// <param name="lod">A number that specifies the mipmap level. If the value is &lt;=0, the zero'th (biggest map)
        /// is used. The fractional value (if supplied) is used to interpolate between two mipmap levels.</param>
        /// <returns></returns>
        public Number4 SampleLevel(
            ITexture texture, SamplerState samplerState,
            ref Number4 location,
            float lod)
        {
            // TODO: Don't always pass minifying=true to GetFilteredColor.

            switch (samplerState.Filter)
            {
                case Filter.MinPointMagLinearMipPoint:
                case Filter.MinLinearMagMipPoint:
                case Filter.MinMagLinearMipPoint:
                case Filter.MinMagMipPoint:
                {
                    // Calculate nearest mipmap level.
                    var nearestLevel = MathUtility.Round(lod);
                    return GetFilteredColor(texture, samplerState, true, nearestLevel, ref location);
                }
                case Filter.MinLinearMagPointMipLinear:
                case Filter.MinMagMipLinear:
                case Filter.MinMagPointMipLinear:
                case Filter.MinPointMagMipLinear:
                {
                    // Calculate nearest two levels and linearly filter between them.
                    var nearestLevelInt = (int) lod;
                    var d = lod - nearestLevelInt;
                    var c1 = GetFilteredColor(texture, samplerState, true, nearestLevelInt, ref location);
                    var c2 = GetFilteredColor(texture, samplerState, true, nearestLevelInt + 1, ref location);
                    return Number4.Lerp(ref c1, ref c2, d);
                }
                default:
                    throw new NotSupportedException();
            }
        }
예제 #8
0
 public void SetTextureParameter(string name, ITexture texture)
 {
   if (!_textureParameters.ContainsKey(name))
     throw new ApplicationException("Texture doesnt exist in this shader");
   _textureParameters[name] = texture;
   _isDirty = true;
 }
예제 #9
0
		public VirtualMachine(BytecodeContainer bytecode, int numContexts)
		{
            if (bytecode.Shader.Version.ProgramType == ProgramType.PixelShader && numContexts % 4 != 0)
                throw new ArgumentOutOfRangeException("numContexts", "numContexts must be a multiple of 4 for pixel shaders.");

			_bytecode = bytecode;

			var instructionTokens = bytecode.Shader.Tokens.OfType<InstructionToken>().ToArray();
			var branchingInstructions = ExplicitBranchingRewriter.Rewrite(instructionTokens);
			var controlFlowGraph = ControlFlowGraph.FromInstructions(branchingInstructions);
            _executableInstructions = ExecutableInstructionRewriter.Rewrite(controlFlowGraph).ToArray();

			_requiredRegisters = RequiredRegisters.FromShader(bytecode.Shader);

			_executionContexts = new ExecutionContext[numContexts];
			for (int i = 0; i < _executionContexts.Length; i++)
				_executionContexts[i] = new ExecutionContext(this, i, _requiredRegisters);

            ConstantBuffers = new Number4[_requiredRegisters.ConstantBuffers.Count][];
            for (int i = 0; i < _requiredRegisters.ConstantBuffers.Count; i++)
                ConstantBuffers[i] = new Number4[_requiredRegisters.ConstantBuffers[i]];

		    TextureSamplers = new TextureSampler[_requiredRegisters.Resources.Count];
			for (int i = 0; i < _requiredRegisters.Resources.Count; i++)
				TextureSamplers[i] = TextureSamplerFactory.Create(_requiredRegisters.Resources[i]);

            Textures = new ITexture[_requiredRegisters.Resources.Count];
            Samplers = new SamplerState[_requiredRegisters.Samplers];
		}
예제 #10
0
파일: CPlayer.cs 프로젝트: whztt07/DGLE
        public CPlayer(IGameObjectManager pObjMan, IEngineCore pEngineCore)
            : base(pObjMan, pEngineCore)
        {
            _fVelocity = 0f;
            uiShotPause = 15;

            ObjType = EGameObjectType.GotPlayer;

            _stPos = new TPoint2(Res.GameVpWidth / 2f, Res.GameVpHeight / 2f);
            _fSize = 150f;
            _fColScale = 0.6f;

            dimPl = new TPoint3(_fSize, _fSize, _fSize);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys);
            pInput = (IInput)pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.MeshShip, out pBaseObj);
            pMesh = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexShip, out pBaseObj);
            pTex = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;
        }
예제 #11
0
 public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture, int roundDecimals)
 {
     var solid = new Solid(generator.GetNextObjectID()) { Colour = Colour.GetRandomBrushColour() };
     // The higher Z plane will be triangle, with the lower X value getting the two corners
     var c1 = new Coordinate(box.Start.X, box.Start.Y, box.End.Z).Round(roundDecimals);
     var c2 = new Coordinate(box.End.X, box.Start.Y, box.End.Z).Round(roundDecimals);
     var c3 = new Coordinate(box.Center.X, box.End.Y, box.End.Z).Round(roundDecimals);
     var c4 = new Coordinate(box.Center.X, box.Center.Y, box.Start.Z).Round(roundDecimals);
     var faces = new[]
                     {
                         new[] { c3, c2, c1 },
                         new[] { c3, c1, c4 },
                         new[] { c2, c3, c4 },
                         new[] { c1, c2, c4 }
                     };
     foreach (var arr in faces)
     {
         var face = new Face(generator.GetNextFaceID())
                        {
                            Parent = solid,
                            Plane = new Plane(arr[0], arr[1], arr[2]),
                            Colour = solid.Colour,
                            Texture = { Texture = texture }
                        };
         face.Vertices.AddRange(arr.Select(x => new Vertex(x, face)));
         face.UpdateBoundingBox();
         face.AlignTextureToFace();
         solid.Faces.Add(face);
     }
     solid.UpdateBoundingBox();
     yield return solid;
 }
예제 #12
0
 public void Render(float4x4 camMtx)
 {
     _rc.ModelView = camMtx*float4x4.CreateTranslation(0,0,0) * float4x4.Scale(40,15,40);
     _rc.SetShader(MoreShaders.GetSkyboxShader(_rc));
     _iTex = _rc.CreateTexture(imgData);
     _rc.Render(_syboxMesh);
 }
예제 #13
0
 public LevelView(ILevel level, ISpriteBatch spriteBatch, ITexture texture, ICamera camera)
 {
     _level = level;
     _spriteBatch = spriteBatch;
     _texture = texture;
     _camera = camera;
 }
예제 #14
0
파일: CShot.cs 프로젝트: whztt07/DGLE
        public CShot(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fAngle)
            : base(pObjMan, pEngineCore)
        {
            ObjType = EGameObjectType.GotShot;

            RenderLayer = 3;
            _fSize = 64f;
            _fColScale = 0.5f;
            this._stPos = stPos;
            this._fAngle = fAngle;

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;

            ISoundSample p_snd;
            pResMan.GetResourceByName(Res.SndFire, out pBaseObj);
            p_snd = (ISoundSample)pBaseObj;
            p_snd.Play();
        }
예제 #15
0
파일: IMaterial.cs 프로젝트: Kintaro/Art
		/// <summary>
		/// 
		/// </summary>
		/// <param name="d"></param>
		/// <param name="dgGeom"></param>
		/// <param name="dgShading"></param>
		/// <param name="dgBump"></param>
		/// <returns></returns>
		public static async Task<DifferentialGeometry> BumpAsync (ITexture<double> d, DifferentialGeometry dgGeom, DifferentialGeometry dgShading)
		{
			var dgBump = new DifferentialGeometry ();
			var dgEval = new DifferentialGeometry (dgShading);

			var du = .5 * (Math.Abs (dgShading.dudx) + Math.Abs (dgShading.dudy));
			if (du == 0.0)
				du = .01;

			dgEval.p = dgShading.p + du * dgShading.dpdu;
			dgEval.u = dgShading.u + du;
			dgEval.nn = null;// TODO

			var uDisplace = await d.EvaluateAsync (dgEval);

			var dv = .5 * (Math.Abs (dgShading.dvdx) + Math.Abs (dgShading.dvdy));
			//

			var vDisplace = await d.EvaluateAsync (dgEval);
			var displace = await d.EvaluateAsync (dgShading);

			dgBump = new DifferentialGeometry (dgShading);
			dgBump.dpdu = dgShading.dpdu + (uDisplace - displace) / du * new Vector (dgShading.nn) + displace * new Vector (dgShading.dndu);
			dgBump.dpdv = dgShading.dpdv + (vDisplace - displace) / dv * new Vector (dgShading.nn) + displace * new Vector (dgShading.dndv);

			if (dgShading.Shape.ReverseOrientation ^ dgShading.Shape.TransformSwapsHandedness)
				dgBump.nn *= -1.0;

			dgBump.nn = Util.FaceForward (dgBump.nn, dgGeom.nn);

			return dgBump;
		}
예제 #16
0
 //------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------
 public void Init(ITexture diffuse, ITexture normal, ITexture position, ITexture accumulation)
 {
     this._diffuseBuffer = diffuse;
     this._normalBuffer = normal;
     this._positionBuffer = position;
     this._accBuffer = accumulation;
 }
예제 #17
0
 public ConsoleOverlaySetView(IOverlayView inputView, IOverlayView commandConsoleView, IOverlayView messageConsoleView, IOverlayView possibleCommandsView, ISpriteBatch spriteBatch, ITexture texture, IFont font)
     : base(spriteBatch, texture, font)
 {
     _overlays.Add(inputView);
     _overlays.Add(commandConsoleView);
     _overlays.Add(messageConsoleView);
     _overlays.Add(possibleCommandsView);
 }
예제 #18
0
        public void Draw(ITexture texture, global::System.Drawing.Point position)
        {
            Texture mainTexture = texture as Texture;

            graphicsDevice.BlendState = BlendState.Additive;

            spriteBatch.Draw(mainTexture.Texture2D, new Rectangle(position.X, position.Y, texture.Width, texture.Height), new Color(255, 255, 255, texture.Alpha));
        }
예제 #19
0
 public Skybox(RenderContext rc)
 {
     // load texture
     imgData = rc.LoadImage("Assets/skyboxOberflächenfarbe.jpg");
     _iTex = rc.CreateTexture(imgData);
     _rc = rc;
     _syboxMesh = MeshReader.LoadMesh(@"Assets/skybox.obj.model");
 }
예제 #20
0
 public Number4 SampleGrad(
     ITexture texture, SamplerState samplerState,
     ref Number4 location,
     ref Number4 ddx, ref Number4 ddy)
 {
     var lod = CalculateLevelOfDetail(texture, samplerState, ref ddx, ref ddy);
     return SampleLevel(texture, samplerState, ref location, lod);
 }
예제 #21
0
        public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture, int roundDecimals)
        {
            var numsides = (int) _numSides.GetValue();
            if (numsides < 3) yield break;

            // Cylinders can be elliptical so use both major and minor rather than just the radius
            // NOTE: when a low number (< 10ish) of faces are selected this will cause the cylinder to not touch all the edges of the box.
            var width = box.Width;
            var length = box.Length;
            var height = box.Height;
            var major = width / 2;
            var minor = length / 2;
            var angle = 2 * DMath.PI / numsides;

            // Calculate the X and Y points for the ellipse
            var points = new Coordinate[numsides];
            for (var i = 0; i < numsides; i++)
            {
                var a = i * angle;
                var xval = box.Center.X + major * DMath.Cos(a);
                var yval = box.Center.Y + minor * DMath.Sin(a);
                var zval = box.Start.Z;
                points[i] = new Coordinate(xval, yval, zval).Round(roundDecimals);
            }

            var faces = new List<Coordinate[]>();

            // Add the vertical faces
            var z = new Coordinate(0, 0, height).Round(roundDecimals);
            for (var i = 0; i < numsides; i++)
            {
                var next = (i + 1) % numsides;
                faces.Add(new[] {points[i], points[i] + z, points[next] + z, points[next]});
            }
            // Add the elliptical top and bottom faces
            faces.Add(points.ToArray());
            faces.Add(points.Select(x => x + z).Reverse().ToArray());

            // Nothing new here, move along
            var solid = new Solid(generator.GetNextObjectID()) { Colour = Colour.GetRandomBrushColour() };
            foreach (var arr in faces)
            {
                var face = new Face(generator.GetNextFaceID())
                {
                    Parent = solid,
                    Plane = new Plane(arr[0], arr[1], arr[2]),
                    Colour = solid.Colour,
                    Texture = { Texture = texture }
                };
                face.Vertices.AddRange(arr.Select(x => new Vertex(x, face)));
                face.UpdateBoundingBox();
                face.AlignTextureToFace();
                solid.Faces.Add(face);
            }
            solid.UpdateBoundingBox();
            yield return solid;
        }
예제 #22
0
 public Subsurface(double sc, ITexture<Spectrum> kr, ITexture<Spectrum> sa, ITexture<Spectrum> sps, ITexture<double> e, ITexture<double> bump)
 {
     Scale = sc;
     Kr = kr;
     SigmaA = sa;
     SigmaPrimeS = sps;
     Eta = e;
     BumpMap = bump;
 }
        public PlanetMaterial(ShaderProgram shaderProgram, string texturePath)
        {
            sp = shaderProgram;

            TextureParam = sp.GetShaderParam("texture1");

            var image = SceneManager.RC.LoadImage(texturePath);
            Tex = SceneManager.RC.CreateTexture(image);
        }
예제 #24
0
		public void SetSky( ITexture texture ) {
			Engine.Atmosphere.SkySphere_SetRadius( 1000 );
			Engine.Atmosphere.SkySphere_SetTexture( texture.ID );
			Engine.Atmosphere.SkySphere_Enable( true );

//			Engine.Atmosphere.SkyBox_SetDistance( 1000 );
//			Engine.Atmosphere.SkyBox_SetTexture( texture.ID,texture.ID,texture.ID,texture.ID,texture.ID,texture.ID );
//			Engine.Atmosphere.SkyBox_Enable(true, true);
		}
 public SpecularMaterial(ShaderProgram shaderProgram, string texturepath)
 {
     sp = shaderProgram;
     Textureparam = sp.GetShaderParam("texture1");
     SpecularLevel = sp.GetShaderParam("specularLevel");
     Shininess = sp.GetShaderParam("shininess");
     ImageData Image = SceneManager.RC.LoadImage(texturepath);
     Tex = SceneManager.RC.CreateTexture(Image);
 }
예제 #26
0
        public MapTextureStageView( MapTextureStageModel maptexturestagemodel )
        {
            LogFile.WriteLine( "MapTextureStageView(" + maptexturestagemodel + ")" );
            this.maptexturestagemodel = maptexturestagemodel;
            splattexture = new GlTexture( maptexturestagemodel.splattexture, false );
            blendtexture = new GlTexture( maptexturestagemodel.blendtexture, true );

            maptexturestagemodel.Changed += new MapTextureStageModel.ChangedHandler( maptexturestagemodel_Changed );
        }
예제 #27
0
 // FIXME: This is preposterously naive at the moment. -- andy
 public void Draw(ITexture tex, Vector3 position)
 {
     sprite.Draw(
         ((Texture)tex).tex,
         /* srcRectRef */ new SharpDX.Rectangle(0, 0, 16, 16),
         /* centerRef  */ new SharpDX.Vector3(0, 0, 0),
         /* posRef     */ position.ToSharpDX(),
         /* color      */ SharpDX.Colors.White
     );
 }
예제 #28
0
		public void Draw( ITexture t, float x, float y, float rotation, float scale ) {
			_render_surface.StartRender(false);
			Engine.Screen2DImmediate.ACTION_Begin2D();
			int white = Engine.Gl.RGBA( 1, 1, 1, 1 );
// T00 slow!
//			Engine.Screen2DImmediate.DRAW_TextureRotated( t.ID, x, y, t.Width*scale, t.Height*scale, rotation, 0, 0, 1, 1, white, white, white, white );
			Engine.Screen2DImmediate.DRAW_Texture( t.ID, x, y, x+Constants.terrainPieceTextureWidth, y+Constants.terrainPieceTextureWidth, white, white, white, white, 0, 0, 1, 1 );
			Engine.Screen2DImmediate.ACTION_End2D();
			_render_surface.EndRender();
		}
예제 #29
0
        public GLImage(IBitmap bitmap, string id, ITexture texture, ISpriteSheet spriteSheet, ILoadImageConfig loadConfig)
		{
			OriginalBitmap = bitmap;
			Width = bitmap.Width;
			Height = bitmap.Height;
			ID = id;
			Texture = texture;
			SpriteSheet = spriteSheet;
			LoadConfig = loadConfig;
		}
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="planet">Planet to render</param>
 /// <param name="effectPath">Path to the terrain effect</param>
 public PlanetPackTextureTechnique( IPlanet planet, string effectPath )
 {
     Arguments.CheckNotNull( planet, "planet" );
     Arguments.CheckNotNullOrEmpty( effectPath, "effectPath" );
     m_Planet = planet;
     m_NoiseTexture = ( ITexture2d )AssetManager.Instance.Load( "Terrain/TiledNoise.noise.jpg" );
     m_Effect = new EffectAssetHandle( effectPath, true );
     m_Effect.OnReload += Effect_OnReload;
     m_Technique = new TechniqueSelector( m_Effect, "DefaultTechnique" );
 }
예제 #31
0
 public void CopyTo(ITexture destination, int srcLayer, int dstLayer, int srcLevel, int dstLevel)
 {
     _renderer.New <TextureCopyToSliceCommand>().Set(Ref(this), Ref((ThreadedTexture)destination), srcLayer, dstLayer, srcLevel, dstLevel);
     _renderer.QueueCommand();
 }
예제 #32
0
파일: Lambertian.cs 프로젝트: rje/ray
 public Lambertian(Vec3 albedo)
 {
     Texture = new SolidColor {
         Color = albedo
     };
 }
예제 #33
0
 public void SetPalette(ITexture palette)
 {
     shader.SetTexture("Palette", palette);
 }
예제 #34
0
파일: World.cs 프로젝트: 628426/Strive.NET
 public void SetSky(ITexture texture)
 {
     scene.SetSky("sky", texture);
 }
예제 #35
0
 public Sheet(SheetT type, ITexture texture)
 {
     Type         = type;
     this.texture = texture;
     Size         = texture.Size;
 }
예제 #36
0
 protected override void OnRelease()
 {
     Texture  = null;
     Material = null;
 }
예제 #37
0
 public void Draw(ITexture texture)
 {
     Debug.Assert(texture == null);
 }
예제 #38
0
파일: Lambertian.cs 프로젝트: rje/ray
 public Lambertian(ITexture texture)
 {
     Texture = texture;
 }
 public Isotropic(ITexture albedo)
 {
     _albedo = albedo;
 }
예제 #40
0
 public LambertianMaterial(ITexture albedo)
 {
     Albedo = albedo;
 }
예제 #41
0
 public void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter)
 {
     _renderer.TextureCopy.Copy(this, (TextureView)destination, srcRegion, dstRegion, linearFilter);
 }
예제 #42
0
 public void CopyTo(ITexture destination, int firstLayer, int firstLevel)
 {
     _renderer.New <TextureCopyToCommand>().Set(Ref(this), Ref((ThreadedTexture)destination), firstLayer, firstLevel);
     _renderer.QueueCommand();
 }
예제 #43
0
 public void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter)
 {
     throw new NotSupportedException();
 }
예제 #44
0
 public void UpdateImage(int id, ITexture texture)
 {
 }
예제 #45
0
 public void CopyTo(ITexture destination, int srcLayer, int dstLayer, int srcLevel, int dstLevel)
 {
     throw new NotSupportedException();
 }
예제 #46
0
        public static byte[] GetRgbaImage(ITexture model, int mipMapLevel = 0)
        {
            var x = model.GetTextureData(mipMapLevel);

            switch (model.Format)
            {
            // compressed formats...
            case TextureFormat.D3DFMT_DXT1:
                return(TextureCompressionHelper.DecompressBC1(x, model.Width, model.Height));

            case TextureFormat.D3DFMT_DXT3:
            {
                return(TextureCompressionHelper.DecompressBC2(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_DXT5:
            {
                return(TextureCompressionHelper.DecompressBC3(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_ATI1:
            {
                return(TextureCompressionHelper.DecompressBC4(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_ATI2:
            {
                return(TextureCompressionHelper.DecompressBC5(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_BC7:
            {
                return(TextureCompressionHelper.DecompressBC7(x, model.Width, model.Height));
            }

            // uncompressed formats...
            case TextureFormat.D3DFMT_A8:
            {
                return(TextureConvert.MakeRGBAFromA8(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_L8:
            {
                return(TextureConvert.MakeARGBFromL8(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_A1R5G5B5:
            {
                return(TextureConvert.MakeARGBFromA1R5G5B5(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_A8B8G8R8:
            {
                return(TextureConvert.MakeRGBAFromA8B8G8R8(x, model.Width, model.Height));
            }

            case TextureFormat.D3DFMT_A8R8G8B8:
            {
                return(TextureConvert.MakeRGBAFromA8R8G8B8(x, model.Width, model.Height));
            }

            default:
                throw new System.Exception("unknown format");
            }
        }
예제 #47
0
 public NFTImageAsset(ITexture previewTexture, int hqResolution, Action <Texture2D> textureUpdateCallback)
 {
     this.previewAsset          = previewTexture;
     this.hqResolution          = hqResolution;
     this.textureUpdateCallback = textureUpdateCallback;
 }