public static extern InteropBool ResourceFactory_CreateSSO( IntPtr failReason, DeviceHandle deviceHandle, TextureFilterType filterType, TextureWrapMode wrapMode, AnisotropicFilteringLevel maxAnisotropy, float borderColorR, float borderColorG, float borderColorB, float borderColorA, IntPtr outSamplerStateHandle );
/// <summary> /// Create a new Texture Sampler object. /// </summary> /// <param name="filterType">The filter method to use.</param> /// <param name="wrapMode">The wrap mode to use.</param> /// <param name="maxAnisotropy">If <paramref name="filterType"/> is set to <see cref="TextureFilterType.Anisotropic"/>, /// this field is used to determine the maximum filter level for anisotropic filtering.</param> /// <param name="borderColor">If <paramref name="wrapMode"/> is set to <see cref="TextureWrapMode.Border"/>, /// this field is used to determine the out-of-bounds colour around the border of mapped textures. /// The range for each element in the <see cref="TexelFormat.RGB32Float"/> structure is <c>0f</c> to <c>1f</c>.</param> public TextureSampler(TextureFilterType filterType, TextureWrapMode wrapMode, AnisotropicFilteringLevel maxAnisotropy, TexelFormat.RGB32Float borderColor = new TexelFormat.RGB32Float()) : base(CreateTextureSampler(filterType, wrapMode, maxAnisotropy, borderColor), ResourceUsage.Immutable, SSO_SIZE_BYTES) { FilterType = filterType; WrapMode = wrapMode; MaxAnisotropy = maxAnisotropy; BorderColor = borderColor; Assure.BetweenOrEqualTo(borderColor.R, 0f, 1f, "Each element in the given border colour must lie between 0f and 1f."); Assure.BetweenOrEqualTo(borderColor.G, 0f, 1f, "Each element in the given border colour must lie between 0f and 1f."); Assure.BetweenOrEqualTo(borderColor.B, 0f, 1f, "Each element in the given border colour must lie between 0f and 1f."); }
public SamplerStateInfo() { // NOTE: These match the defaults of SamplerState. _minFilter = TextureFilterType.Linear; _magFilter = TextureFilterType.Linear; _mipFilter = TextureFilterType.Linear; _addressU = TextureAddressMode.Wrap; _addressV = TextureAddressMode.Wrap; _addressW = TextureAddressMode.Wrap; _borderColor = Color.White; _maxAnisotropy = 4; _maxMipLevel = 0; _mipMapLevelOfDetailBias = 0.0f; }
public void OnInspectorGUI(Action onValueChanged) { var newOutputType = (TextureOutputType)EditorGUILayout.EnumPopup("Output Format", m_outputType); if (newOutputType != m_outputType) { m_outputType = newOutputType; onValueChanged(); } if (m_outputType == TextureOutputType.JPG) { var newQuality = EditorGUILayout.IntSlider("JPG Quality", m_jpgQuality, 1, 100); if (newQuality != m_jpgQuality) { m_jpgQuality = newQuality; onValueChanged(); } } #if UNITY_5_6_OR_NEWER if (m_outputType == TextureOutputType.EXR) { var exrOpt = (Texture2D.EXRFlags)EditorGUILayout.EnumPopup("EXR Option", m_exrFlags); if (exrOpt != m_exrFlags) { m_exrFlags = exrOpt; onValueChanged(); } } #endif var newScaleType = (TextureFilterType)EditorGUILayout.EnumPopup("Filter Mode", m_filterType); if (newScaleType != m_filterType) { m_filterType = newScaleType; onValueChanged(); } var newScale = EditorGUILayout.Slider("Scale(%)", m_scale * 100f, 1.0f, 100.0f); newScale = newScale / 100f; if (m_scale != newScale) { m_scale = newScale; onValueChanged(); } }
private static unsafe SamplerStateResourceHandle CreateTextureSampler(TextureFilterType filterType, TextureWrapMode wrapMode, AnisotropicFilteringLevel maxAnisotropy, TexelFormat.RGB32Float borderColor) { SamplerStateResourceHandle outResourceHandle; InteropUtils.CallNative( NativeMethods.ResourceFactory_CreateSSO, RenderingModule.Device, filterType, wrapMode, maxAnisotropy, borderColor.R, borderColor.G, borderColor.B, 1f, (IntPtr)(&outResourceHandle) ).ThrowOnFailure(); return(outResourceHandle); }
public void SetTextureFilterType(string name, TextureFilterType filter) { CoreInstance.SetTextureFilterType(name, (swig.TextureFilterType)filter); }
public void SetTextureFilterType(string name, TextureFilterType filter) { SwigObject.SetTextureFilterType(name, (swig.TextureFilterType)filter); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="filter"></param> public void SetTextureFilterType(string name, TextureFilterType filter) { CoreInstance.SetTextureFilterType(name, (asd.swig.TextureFilterType)filter); }