private void SaveTexture(Texture texture, int index) { using (var stream = BaseTexture.ToStream(texture, ImageFileFormat.Png)) using (var sr = new BinaryReader(stream)) using (var fs = new FileStream(string.Format("overlay_{0}_{1}.png", index, (n++)), FileMode.Create)) using (var sw = new BinaryWriter(fs)) { byte[] buffer = new byte[512]; int bytesRead; while ((bytesRead = sr.Read(buffer, 0, buffer.Length)) > 0) { sw.Write(buffer, 0, bytesRead); } } }
public void SetTexture(int sampler, BaseTexture texture) { #if DEBUG_STATE_MANAGER var s = device.GetTexture(sampler); if (textures[sampler] != s) { throw new Exception("State inconsistent, " + textures[sampler] + " != " + s); } #endif if (textures[sampler] != texture) { device.SetTexture(sampler, texture); textures[sampler] = texture; } }
/// <summary> /// Mod_LoadBrushModel /// </summary> public void LoadBrushModel(BrushModelData mod, byte[] buffer) { mod.Load(mod.Name, buffer, (tx) => { if (tx.name != null && tx.name.StartsWith("sky")) // !Q_strncmp(mt->name,"sky",3)) { this.Host.RenderContext.WarpableTextures.InitSky(tx); } else { tx.texture = BaseTexture.FromBuffer( this.Host.Video.Device, tx.name, new ByteArraySegment(tx.pixels), ( int )tx.width, ( int )tx.height, true, true); } }, (textureFile) => { var lowerName = textureFile.ToLower( ); if (this.Host.WadTextures.ContainsKey(lowerName)) { var wadFile = this.Host.WadTextures[lowerName]; var wad = this.Host.WadFiles[wadFile]; return(wad.GetLumpBuffer(textureFile)); } return(null); }); // // set up the submodels (FIXME: this is confusing) // for (var i = 0; i < mod.NumSubModels; i++) { mod.SetupSubModel(ref mod.SubModels[i]); if (i < mod.NumSubModels - 1) { // duplicate the basic information var name = "*" + (i + 1).ToString( ); this.CurrentModel = this.FindName(name, ModelType.mod_brush); this.CurrentModel.CopyFrom(mod); // *loadmodel = *mod; this.CurrentModel.Name = name; //strcpy (loadmodel->name, name); mod = ( BrushModelData )this.CurrentModel; //mod = loadmodel; } } }
private static byte[] GetDdsData(Device device, Bitmap bitmap, bool withHeader) { byte[] result; var argb = GetArgb8888(bitmap, out var stride, out var width, out var height); var rgb = Argb8888ToRgb565(argb, stride, width, height); using (var texture = new Texture(device, width, height, DefaultDdsMipLevels, Usage.None, Format.R5G6B5, Pool.Scratch)) { texture.LockRectangle(0, LockFlags.None, out var dataStream); dataStream.Write(rgb, 0, rgb.Length); texture.UnlockRectangle(0); using (var ds = BaseTexture.ToStream(texture, ImageFileFormat.Dds)) { using (var memory = new MemoryStream()) { var buffer = new byte[10240]; var read = 1; while (read > 0) { read = ds.Read(buffer, 0, buffer.Length); if (read > 0) { memory.Write(buffer, 0, read); } } result = memory.ToArray(); } } } if (!withHeader) { const int ddsHeaderSize = 0x80; var newArray = new byte[result.Length - ddsHeaderSize]; Array.Copy(result, ddsHeaderSize, newArray, 0, newArray.Length); result = newArray; } return(result); }
public void Reset() { states = new int[System.Enum.GetNames(typeof(RenderState)).Length * 2]; for (int i = 0; i < states.Length; i++) { states[i] = -1; } samplerStates = new int[16, System.Enum.GetNames(typeof(SamplerState)).Length * 2]; for (int x = 0; x < samplerStates.GetLength(0); x++) { for (int y = 0; y < samplerStates.GetLength(1); y++) { samplerStates[x, y] = -1; } } textures = new BaseTexture[16]; }
public static BaseModel Create(BaseDevice device, string identifier, BaseTexture texture, Type modelType, Type descType) { if (BaseModel.ModelPool.ContainsKey(identifier)) { return(BaseModel.ModelPool[identifier]); } var desc = ( BaseAliasModelDesc )Activator.CreateInstance(descType); desc.Name = identifier; desc.Texture = texture; var model = ( BaseModel )Activator.CreateInstance(modelType, device, desc); model.Initialise( ); return(model); }
protected void UpdateProperties(BaseTexture texture) { SurfaceDescription desc; Texture tex = texture as Texture; if (tex != null) { desc = tex.GetLevelDescription(0); } else { CubeTexture ctex = texture as CubeTexture; desc = ctex.GetLevelDescription(0); } Width = desc.Width; Height = desc.Height; Format = desc.Format; }
private static void DrawSpriteMain(BaseTexture texture, CubeMapFace?face, ref RectangleF destination, bool scaleDestination, Rectangle?sourceRectangle, Color color, Vector2 rightVector, ref Vector2 origin, SpriteEffects effects, float depth) { if (m_screenshot != null && m_screenshot.IgnoreSprites) { return; } m_spriteBatch.DrawSprite( texture, face, ref destination, scaleDestination, sourceRectangle, color, rightVector, ref origin, effects, depth); }
/// <summary> /// Draws the sub sprite with the given index from the atlas using the nine cut method /// This is mostly useful for gui elements like forms and buttons /// </summary> /// <param name="sb"></param> /// <param name="index"></param> /// <param name="dest"></param> /// <param name="source"></param> /// <param name="color"></param> /// <param name="destEdge"></param> /// <param name="sourceEdge"></param> public void DrawNineCut(SpriteBatch sb, string spriteDef, Rectangle dest, Rectangle?source = null, Color?color = null, int?destEdge = null, int?sourceEdge = null, Vector2?scale = null, Vector2?origin = null, float rotation = 0) { Rectangle def; bool res = SpriteDefinitions.TryGetValue(spriteDef, out def); if (!res) { ConsoleManager.Instance.WriteLine($"Could not find sprite '{spriteDef}' in '{BaseTexture.Path}'"); return; } if (source == null) { source = def; } Rectangle finalSource = new Rectangle(def.X + source.Value.X, def.Y + source.Value.Y, source.Value.Width, source.Value.Height); BaseTexture.DrawNineCut(sb, dest, finalSource, color, destEdge, sourceEdge, scale, origin, rotation); }
public virtual void Draw(SpriteBatch spriteBatch) { if (!IsShow) { return; } if (IsClicked && ClickedTexture != null) { ClickedTexture.Draw(spriteBatch, ScreenPosition); } else if (IsMouveOver && MouseOverTexture != null) { MouseOverTexture.Draw(spriteBatch, ScreenPosition); } else if (BaseTexture != null) { BaseTexture.Draw(spriteBatch, ScreenPosition); } }
private IEnumerable <Vector2> GetTileCenters(Texture2D distortedBaseMap) { TileCenterCounter[] centerCounters = new TileCenterCounter[MaxIndex]; for (int i = 0; i < MaxIndex; i++) { centerCounters[i] = new TileCenterCounter(); } for (int x = 0; x < BaseTexture.width; x++) { for (int y = 0; y < BaseTexture.height; y++) { Color pixel = BaseTexture.GetPixel(x, y); int index = ToIndex(pixel); float xParam = (float)x / BaseTexture.width; float yParam = (float)y / BaseTexture.height; centerCounters[index].RegisterPixel(xParam, yParam); } } return(centerCounters.Select(item => item.GetTileCenter())); }
public TextureBase(int cubeSize, bool renderTarget) { Framework.Instance.DeviceCreated += new Bonsai.Core.EventArgs.DeviceEventHandler(Instance_DeviceCreated); Framework.Instance.DeviceLost += new EventHandler(Instance_DeviceLost); Framework.Instance.DeviceReset += new Bonsai.Core.EventArgs.DeviceEventHandler(Instance_DeviceReset); this.lowLevel = true; this.width = cubeSize; this.height = cubeSize; this.cubeMap = true; this.fileName = null; this.renderTarget = renderTarget; if (renderTarget) { this.texture = new CubeTexture(Framework.Instance.Device, cubeSize, 1, Usage.Dynamic, Framework.Instance.Device.PresentationParameters.BackBufferFormat, Pool.Default); } else { this.texture = new CubeTexture(Framework.Instance.Device, cubeSize, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default); } }
void Instance_DeviceReset(object sender, Bonsai.Core.EventArgs.DeviceEventArgs e) { if (lowLevel) { if (texture != null) { texture.Dispose(); texture = null; } if (cubeMap) { if (renderTarget) { this.texture = new CubeTexture(Framework.Instance.Device, width, 1, Usage.RenderTarget, Framework.Instance.Device.PresentationParameters.BackBufferFormat, Pool.Default); } else { this.texture = new CubeTexture(Framework.Instance.Device, width, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default); } } else { if (renderTarget) { this.texture = new Texture(Framework.Instance.Device, width, height, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default); } else { this.texture = new Texture(Framework.Instance.Device, width, height, 1, Usage.RenderTarget, Framework.Instance.Device.PresentationParameters.BackBufferFormat, Pool.Default); } } } else { LoadTexture(folder); } }
// beamlength // R_InitParticleTexture public void InitParticleTexture( ) { var data = new byte[8 * 8 * 4]; var i = 0; for (var x = 0; x < 8; x++) { for (var y = 0; y < 8; y++, i += 4) { data[i] = 255; data[i + 1] = 255; data[i + 2] = 255; data[i + 3] = ( byte )(ParticleDef._DotTexture[x, y] * 255); } } var uintData = new uint[data.Length / 4]; Buffer.BlockCopy(data, 0, uintData, 0, data.Length); this.ParticleTexture = BaseTexture.FromBuffer(this.Device, "_Particles", uintData, 8, 8, false, true, "GL_LINEAR", "GL_MODULATE"); }
public override void DrawWaterPolyMultiTexture(byte[] lightMapData, BaseTexture texture, BaseTexture lightMapTexture, int lightMapTextureNumber, GLPoly p, double time) { GL.Enable(EnableCap.Texture2D); texture.Bind( ); GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, ( int )TextureEnvMode.Replace); this.Device.EnableMultitexture( ); lightMapTexture.BindLightmap((( GLTextureDesc )lightMapTexture.Desc).TextureNumber + lightMapTextureNumber); var i = lightMapTextureNumber; if (lightMapTexture.LightMapModified[i]) { lightMapTexture.CommitLightmap(lightMapData, i); } GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, ( int )TextureEnvMode.Blend); GL.Begin(PrimitiveType.TriangleFan); var nv = new float[3]; for (i = 0; i < p.numverts; i++) { var v = p.verts[i]; GL.MultiTexCoord2(TextureUnit.Texture0, v[3], v[4]); GL.MultiTexCoord2(TextureUnit.Texture1, v[5], v[6]); nv[0] = ( float )(v[0] + 8 * Math.Sin(v[1] * 0.05 + time) * Math.Sin(v[2] * 0.05 + time)); nv[1] = ( float )(v[1] + 8 * Math.Sin(v[0] * 0.05 + time) * Math.Sin(v[2] * 0.05 + time)); nv[2] = v[2]; GL.Vertex3(nv); } GL.End( ); GL.Disable(EnableCap.Texture2D); }
public bool AddChild(object child) { var domNode = child.As <DomNode>(); if (domNode != null && IsDerivedFrom(domNode, Schema.vegetationSpawnConfigType.Type)) { SetChild(Schema.terrainType.VegetationSpawnChild, domNode); return(true); } if (domNode != null && IsDerivedFrom(domNode, Schema.abstractTerrainMaterialDescType.Type)) { if (BaseTexture == null) { BaseTexture = new DomNode(Schema.terrainBaseTextureType.Type); } BaseTexture.GetChildList(Schema.terrainBaseTextureType.materialChild).Add(domNode); return(true); } return(false); }
/// <summary> /// Mod_LoadBrushModel /// </summary> private void LoadBrush(BrushModelData mod, Byte[] buffer) { mod.Load(mod.Name, buffer, (tx) => { if (tx.name != null && tx.name.StartsWith("sky")) // !Q_strncmp(mt->name,"sky",3)) { Host.RenderContext.WarpableTextures.InitSky(tx); } else { tx.texture = BaseTexture.FromBuffer(Host.Video.Device, tx.name, new ByteArraySegment(tx.pixels), ( Int32 )tx.width, ( Int32 )tx.height, true, true); } }, (textureFile) => { return(Host.Wads.LoadTexture(textureFile)); }); // // set up the submodels (FIXME: this is confusing) // for (var i = 0; i < mod.NumSubModels; i++) { mod.SetupSubModel(ref mod.SubModels[i]); if (i < mod.NumSubModels - 1) { // duplicate the basic information var name = "*" + (i + 1).ToString( ); CurrentModel = FindName(name, ModelType.Brush); CurrentModel.CopyFrom(mod); // *loadmodel = *mod; CurrentModel.Name = name; //strcpy (loadmodel->name, name); mod = ( BrushModelData )CurrentModel; //mod = loadmodel; } } }
public virtual void DrawTexture2D(BaseTexture texture, int x, int y, Color?colour = null, bool hasAlpha = false) { this.DrawTexture2D(texture, x, y, texture.Desc.Width, texture.Desc.Height, colour, hasAlpha); }
public virtual void DrawSpriteModel(BaseTexture texture, mspriteframe_t frame, Vector3 up, Vector3 right, Vector3 origin) { throw new NotImplementedException( ); }
public virtual void DrawTransTranslate(BaseTexture texture, int x, int y, int width, int height, byte[] translation) { throw new NotImplementedException( ); }
/// <summary> /// Saves a texture to a stream. /// </summary> /// <param name="texture">The texture.</param> /// <param name="format">The format.</param> /// <returns>A <see cref="DataStream"/> containing the saved texture.</returns> /// <unmanaged>HRESULT D3DXSaveTextureToFileInMemory([Out] ID3DXBuffer** ppDestBuf,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DBaseTexture9* pSrcTexture,[In, Buffer] const PALETTEENTRY* pSrcPalette)</unmanaged> public static DataStream ToStream(BaseTexture texture, ImageFileFormat format) { return new DataStream(D3DX9.SaveTextureToFileInMemory(format, texture, null )); }
/// <summary> /// Saves a texture to a stream. /// </summary> /// <param name="texture">The texture.</param> /// <param name="format">The format.</param> /// <param name="palette">The palette.</param> /// <returns>A <see cref="DataStream"/> containing the saved texture.</returns> /// <unmanaged>HRESULT D3DXSaveTextureToFileInMemory([Out] ID3DXBuffer** ppDestBuf,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DBaseTexture9* pSrcTexture,[In, Buffer] const PALETTEENTRY* pSrcPalette)</unmanaged> public static DataStream ToStream(BaseTexture texture, ImageFileFormat format, PaletteEntry[] palette) { return(new DataStream(D3DX9.SaveTextureToFileInMemory(format, texture, palette))); }
public static int SetTexture(this Parameter param, BaseTexture tex) { return NativeMethods.cgD3D9SetTexture(param.Handle, tex.ComPointer); }
public virtual void DrawTexture2D(BaseTexture texture, RectangleF sourceRect, Rectangle destRect, Color?colour = null, bool hasAlpha = false) { throw new NotImplementedException( ); }
/// <summary> /// Saves a texture to a file. /// </summary> /// <param name="texture">The texture.</param> /// <param name="fileName">Name of the file.</param> /// <param name="format">The format.</param> /// <param name="palette">The palette.</param> /// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns> /// <unmanaged>HRESULT D3DXSaveTextureToFileW([In] const wchar_t* pDestFile,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DBaseTexture9* pSrcTexture,[In, Buffer] const PALETTEENTRY* pSrcPalette)</unmanaged> public static void ToFile(BaseTexture texture, string fileName, ImageFileFormat format, PaletteEntry[] palette) { D3DX9.SaveTextureToFileW(fileName, format, texture, palette); }
private int DrawIndexedPrimitiveHook(IntPtr devicePtr, PrimitiveType primitiveType, int baseVertexIndex, int minimumVertexIndex, int numVertices, int startIndex, int primCount) { Device device = (Device)devicePtr; VertexBuffer streamData; int Offset = 0; int Stride = 0; device.GetStreamSource(0, out streamData, out Offset, out Stride); streamData.Dispose(); if (Startlog) { if (Stride == iStride) { baseTexture = device.GetTexture(0); found = false; for (int i = 0; i < baseTextures.Count; i++) { if (baseTextures[i].NativePointer == baseTexture.NativePointer) { found = true; } } if (found == false) { baseTextures.Add(baseTexture); } if (baseTextures[iBaseTex].NativePointer == baseTexture.NativePointer) { bTex = baseTexture.LevelOfDetails; baseVertexIndexFound = baseVertexIndex; minVertexIndexFound = minimumVertexIndex; numVerticesFound = numVertices; startIndexFound = startIndex; primCountFound = primCount; device.SetRenderState(SharpDX.Direct3D9.RenderState.FillMode, SharpDX.Direct3D9.FillMode.Solid); if (redTexture == null) { redTexture = SharpDX.Direct3D9.Texture.FromMemory(device, red); } device.SetTexture(0, redTexture); device.SetRenderState(SharpDX.Direct3D9.RenderState.ZEnable, false); device.DrawIndexedPrimitive(primitiveType, baseVertexIndex, minimumVertexIndex, numVertices, startIndex, primCount); device.SetRenderState(SharpDX.Direct3D9.RenderState.ZEnable, true); found = false; foreach (DXLogger item in stride) { if (item.Base == baseVertexIndex && item.Min == minimumVertexIndex && item.Num == numVertices && item.Start == startIndex && item.Prim == primCount) { found = true; break; } } if (found == false) { strideLog.Base = baseVertexIndex; strideLog.Min = minimumVertexIndex; strideLog.Num = numVertices; strideLog.Start = startIndex; strideLog.Prim = primCount; stride.Add(strideLog); } } } } device.DrawIndexedPrimitive(primitiveType, baseVertexIndex, minimumVertexIndex, numVertices, startIndex, primCount); return(Result.Ok.Code); }
public void SetTexture(int sampler, BaseTexture texture) { #if DEBUG_STATE_MANAGER var s = device.GetTexture(sampler); if (textures[sampler] != s) throw new Exception("State inconsistent, " + textures[sampler] + " != " + s); #endif if (textures[sampler] != texture) { device.SetTexture(sampler, texture); textures[sampler] = texture; } }
public Sole() { model = new Model("MEDIA//Sfera5.x", 0); EffectPool pool = new EffectPool(); effect = Effect.FromFile(LogiX_Engine.Device, "MEDIA//Sun.fx", null, ShaderFlags.None, pool); effectHandles = new EffectHandle[5]; effectHandles[0] = effect.GetTechnique("t0"); effectHandles[1] = effect.GetParameter(null, "matViewProjection"); effectHandles[2] = effect.GetParameter(null, "Time"); effectHandles[3] = effect.GetParameter(null, "Texture"); effectHandles[4] = effect.GetParameter(null, "TexDimension"); baseTexture = TextureLoader.FromFile(LogiX_Engine.Device, "MEDIA//N030.jpg"); Alone = new XMaterial(Color.White, Color.White, Color.Black, 1); light = new DirectionalLight(VertexData.Empty, Color.FromArgb(60, 10, 0), Color.FromArgb(255, 170, 100), Color.FromArgb(250, 250, 250)); }
public virtual void DrawTexture2D(BaseTexture texture, int x, int y, int width, int height, Color?colour = null, bool hasAlpha = false) { this.DrawTexture2D(texture, new(x, y, width, height), colour, hasAlpha); }
public virtual void DrawTexture2D(BaseTexture texture, RectangleF sourceRect, int x, int y, Color?colour = null, bool hasAlpha = false) { this.DrawTexture2D(texture, sourceRect, new(x, y, texture.Desc.Width, texture.Desc.Height), colour, hasAlpha); }
/// <summary> /// Saves a texture to a file. /// </summary> /// <param name="texture">The texture.</param> /// <param name="fileName">Name of the file.</param> /// <param name="format">The format.</param> /// <returns> /// A <see cref="SharpDX.Result"/> object describing the result of the operation. /// </returns> /// <unmanaged>HRESULT D3DXSaveTextureToFileW([In] const wchar_t* pDestFile,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DBaseTexture9* pSrcTexture,[In, Buffer] const PALETTEENTRY* pSrcPalette)</unmanaged> public static void ToFile(BaseTexture texture, string fileName, ImageFileFormat format) { D3DX9.SaveTextureToFileW(fileName, format, texture, null); }
public override void Render(DrawArgs drawArgs) { if (!this.isOn) { return; } if (!this.isInitialized) { this.Initialize(drawArgs); } this.m_pointSprites.Clear(); int closestIconDistanceSquared = int.MaxValue; PointIcon closestIcon = null; // build list of all points in view foreach (PointIcon point in this.m_points.Values) { try { // don't bother to do anything else if we aren't even in view if (drawArgs.WorldCamera.ViewFrustum.ContainsPoint(point.Position)) { Vector3 translationVector = new Vector3( (float)(point.PositionD.X - drawArgs.WorldCamera.ReferenceCenter.X), (float)(point.PositionD.Y - drawArgs.WorldCamera.ReferenceCenter.Y), (float)(point.PositionD.Z - drawArgs.WorldCamera.ReferenceCenter.Z)); Vector3 projectedPoint = drawArgs.WorldCamera.Project(translationVector); // check if inside bounding box of icon int dx = DrawArgs.LastMousePosition.X - (int)projectedPoint.X; int dy = DrawArgs.LastMousePosition.Y - (int)projectedPoint.Y; if (this.SelectionRectangle.Contains(dx, dy)) { // Mouse is over, check whether this icon is closest int distanceSquared = dx * dx + dy * dy; if (distanceSquared < closestIconDistanceSquared) { closestIconDistanceSquared = distanceSquared; closestIcon = point; } } PointSpriteVertex pv = new PointSpriteVertex(translationVector.X, translationVector.Y, translationVector.Z, point.Size, point.Color.ToArgb()); this.m_pointSprites.Add(pv); } } catch { } finally { } } // render point sprites if any in the list try { if (this.m_pointSprites.Count > 0) { // save device state BaseTexture origTexture = drawArgs.device.GetTexture(0); VertexFormat origVertexFormat = drawArgs.device.VertexFormat; float origPointScaleA = drawArgs.device.GetRenderState <float>(RenderState.PointScaleA); float origPointScaleB = drawArgs.device.GetRenderState <float>(RenderState.PointScaleB); float origPointScaleC = drawArgs.device.GetRenderState <float>(RenderState.PointScaleC); bool origPointSpriteEnable = drawArgs.device.GetRenderState <bool>(RenderState.PointSpriteEnable); bool origPointScaleEnable = drawArgs.device.GetRenderState <bool>(RenderState.PointScaleEnable); Blend origSourceBlend = drawArgs.device.GetRenderState <Blend>(RenderState.SourceBlend); Blend origDestBlend = drawArgs.device.GetRenderState <Blend>(RenderState.DestinationBlend); // set device to do point sprites drawArgs.device.SetTexture(0, this.m_pointTexture.Texture); drawArgs.device.VertexFormat = VertexFormat.Position | VertexFormat.PointSize | VertexFormat.Diffuse; drawArgs.device.SetRenderState(RenderState.PointScaleA, 1f); drawArgs.device.SetRenderState(RenderState.PointScaleB, 0f); drawArgs.device.SetRenderState(RenderState.PointScaleC, 0f); drawArgs.device.SetRenderState(RenderState.PointSpriteEnable, true); drawArgs.device.SetRenderState(RenderState.PointScaleEnable, true); drawArgs.device.SetTextureStageState(0, TextureStage.ColorOperation, (int)TextureOperation.Modulate); drawArgs.device.SetTextureStageState(0, TextureStage.ColorArg1, (int)TextureArgument.Texture); drawArgs.device.SetTextureStageState(0, TextureStage.ColorArg2, (int)TextureArgument.Diffuse); // Draw all visible points drawArgs.device.DrawUserPrimitives(PrimitiveType.PointList, this.m_pointSprites.Count, this.m_pointSprites.ToArray()); // Draw label and description of mouseover point if (closestIcon != null) { } // restore device state drawArgs.device.SetTexture(0, origTexture); drawArgs.device.VertexFormat = origVertexFormat; drawArgs.device.SetRenderState(RenderState.PointScaleA, origPointScaleA); drawArgs.device.SetRenderState(RenderState.PointScaleB, origPointScaleB); drawArgs.device.SetRenderState(RenderState.PointScaleC, origPointScaleC); drawArgs.device.SetRenderState(RenderState.PointSpriteEnable, origPointSpriteEnable); drawArgs.device.SetRenderState(RenderState.PointScaleEnable, origPointScaleEnable); drawArgs.device.SetRenderState(RenderState.SourceBlend, origSourceBlend); drawArgs.device.SetRenderState(RenderState.DestinationBlend, origDestBlend); } } catch { } }
/// <summary> /// Set up a new texture AND a normal map texture (either or both can be null) /// </summary> /// <param name="t"></param> public static void SetTexture(BaseTexture tex, Texture bump) { effect.SetValue(baseTexture, tex); effect.SetValue(isTextured, (tex != null) ? true : false); effect.SetValue(bumpTexture, bump); effect.SetValue(isBump, (bump != null) ? true : false); }
public static void SetTextureParameter(this Parameter param, BaseTexture tex) { NativeMethods.cgD3D9SetTextureParameter(param.Handle, tex.ComPointer); }
public virtual void DrawWaterPolyMultiTexture(byte[] lightMapData, BaseTexture texture, BaseTexture lightMapTexture, int lightMapTextureNumber, GLPoly p, double time) { throw new NotImplementedException( ); }
public void SetTexture(int sampler, BaseTexture texture) { device.SetTexture(sampler, texture); }
/// <summary> /// Saves a texture to a stream. /// </summary> /// <param name="texture">The texture.</param> /// <param name="format">The format.</param> /// <returns>A <see cref="DataStream"/> containing the saved texture.</returns> /// <unmanaged>HRESULT D3DXSaveTextureToFileInMemory([Out] ID3DXBuffer** ppDestBuf,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DBaseTexture9* pSrcTexture,[In, Buffer] const PALETTEENTRY* pSrcPalette)</unmanaged> public static DataStream ToStream(BaseTexture texture, ImageFileFormat format) { return(new DataStream(D3DX9.SaveTextureToFileInMemory(format, texture, null))); }
/// <summary> /// Saves a texture to a stream. /// </summary> /// <param name="texture">The texture.</param> /// <param name="format">The format.</param> /// <param name="palette">The palette.</param> /// <returns>A <see cref="DataStream"/> containing the saved texture.</returns> /// <unmanaged>HRESULT D3DXSaveTextureToFileInMemory([Out] ID3DXBuffer** ppDestBuf,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DBaseTexture9* pSrcTexture,[In, Buffer] const PALETTEENTRY* pSrcPalette)</unmanaged> public static DataStream ToStream(BaseTexture texture, ImageFileFormat format, PaletteEntry[] palette) { return new DataStream(D3DX9.SaveTextureToFileInMemory(format, texture, palette)); }
protected void copyFromBaseTexture(BaseTexture baseTexture) { copyFromImageModifer(baseTexture); _method = baseTexture._method; _hasNormalMap = baseTexture._hasNormalMap; }
public void SetValue( string name, BaseTexture val ) { effect.SetValue( GetHandle( name ), val ); }