void UploadResidueMaterials() { MaterialRenderData[] materialArray = new MaterialRenderData[3]; materialArray[0] = GetMaterialRenderData(style.ColorStyle.TurnMaterial); materialArray[1] = GetMaterialRenderData(style.ColorStyle.SheetMaterial); materialArray[2] = GetMaterialRenderData(style.ColorStyle.HelixMaterial); GCHandle arrayHandle = GCHandle.Alloc(materialArray, GCHandleType.Pinned); try { SetResidueMaterials(handle, arrayHandle.AddrOfPinnedObject(), materialArray.Length); } finally { arrayHandle.Free(); } }
static MaterialRenderData GetMaterialRenderData(Material material) { MaterialRenderData data = new MaterialRenderData { Ambient = ToInt32(material.Ambient), Diffuse = ToInt32(material.Diffuse), Specular = ToInt32(material.Specular), Emissive = ToInt32(material.Emissive), Glossiness = (float)material.Glossiness, SpecularPower = (float)material.SpecularPower, ReflectionLevel = (float)material.ReflectionLevel, BumpLevel = (float)material.BumpLevel, EmissiveLevel = (float)material.EmissiveLevel }; return data; }
void UploadElementMaterials() { MaterialRenderData[] materialArray = new MaterialRenderData[Element.Elements.Length]; for (int i = 0; i < materialArray.Length; i++) { Material material = style.ColorStyle.ColorScheme[Element.Elements[i]]; materialArray[i] = GetMaterialRenderData(material); } GCHandle arrayHandle = GCHandle.Alloc(materialArray, GCHandleType.Pinned); try { SetElementMaterials(handle, arrayHandle.AddrOfPinnedObject(), materialArray.Length); } finally { arrayHandle.Free(); } }
/// <summary> /// レンダリングスレッドを構築する。 /// </summary> public MaterialRenderThread() { renderData = new MaterialRenderData(); renderData.ImageChanged += OnImageChanged; }