mirror of
https://github.com/4sval/FModel.git
synced 2026-05-04 12:01:24 -05:00
43 lines
1.0 KiB
C#
43 lines
1.0 KiB
C#
using System;
|
|
using FModel.Views.Snooper.Shading;
|
|
using OpenTK.Graphics.OpenGL4;
|
|
|
|
namespace FModel.Views.Snooper.Models;
|
|
|
|
public class Section : IDisposable
|
|
{
|
|
private int _handle;
|
|
|
|
public readonly int MaterialIndex;
|
|
public readonly int FacesCount;
|
|
public readonly int FirstFaceIndex;
|
|
public readonly IntPtr FirstFaceIndexPtr;
|
|
|
|
public bool Show;
|
|
|
|
public Section(int index, int facesCount, int firstFaceIndex)
|
|
{
|
|
MaterialIndex = index;
|
|
FacesCount = facesCount;
|
|
FirstFaceIndex = firstFaceIndex;
|
|
FirstFaceIndexPtr = new IntPtr(FirstFaceIndex * sizeof(uint));
|
|
Show = true;
|
|
}
|
|
|
|
public Section(int index, int facesCount, int firstFaceIndex, Material material) : this(index, facesCount, firstFaceIndex)
|
|
{
|
|
material.IsUsed = true;
|
|
Show = !material.Parameters.IsNull && !material.Parameters.IsTranslucent;
|
|
}
|
|
|
|
public void Setup()
|
|
{
|
|
_handle = GL.CreateProgram();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
GL.DeleteProgram(_handle);
|
|
}
|
|
}
|