Esempio n. 1
0
    public TessParamGUI() : base()
    {
        m_MaxLength    = new LogValue(m_maxLength_Def, m_maxLength_Min, m_maxLength_Max);
        m_NumVertices  = new LogValue(m_numVertices_Def, m_numVertices_Min, m_numVertices_Max);
        m_MinBoxLength = new LogValue(m_minBoxLength_Def, m_minBoxLength_Min, m_minBoxLength_Max);

        // 簡単設定テーブル
        int nTableSize = m_easySettingTable.Length;

        m_easyToleranceTable = new TessellationTolerance[nTableSize];
        for (int i = 0; i < nTableSize; ++i)
        {
            var easySetting = m_easySettingTable[i];
            var tole        = TessellationTolerance.Default;
            tole.TessAngle       = MoNo.Angle.FromDegree(easySetting.tessAngle);
            tole.TessAspectRatio = (easySetting.tessApectRatio == 0)
                             ? FSharpOption <TessellationAspectRatio> .None
                             : FSharpOption <TessellationAspectRatio> .Some(
                new TessellationAspectRatio()
            {
                MaxRatio  = easySetting.tessApectRatio,
                MinLength = FSharpOption <double> .None
            });

            m_easyToleranceTable[i] = tole;
        }

        // 初期値は真ん中で
        m_nEasyTessLevel = m_nLastEasyTessLevel = nTableSize / 2;
        var src = m_easyToleranceTable[m_nEasyTessLevel];

        m_tolerance = new TessellationTolerance()
        {
            TessAngle       = src.TessAngle,
            TessAspectRatio = src.TessAspectRatio,
            TessMaxLength   = src.TessMaxLength,
            TessDeviation   = src.TessDeviation
        };

#if UNITY_2017_3_OR_NEWER
        // Unity Version 2017.3以降では、頂点数65000でメッシュを分割しない
        m_isDivideAt65kVertices = false;
#else
        // それより前のバージョンでは、頂点数65000でメッシュを分割する
        m_isDivideAt65kVertices = true;
#endif
    }
Esempio n. 2
0
    public TessParamGUI() : base()
    {
        m_MaxLength    = new LogValue(m_maxLength_Def, m_maxLength_Min, m_maxLength_Max);
        m_NumVertices  = new LogValue(m_numVertices_Def, m_numVertices_Min, m_numVertices_Max);
        m_MinBoxLength = new LogValue(m_minBoxLength_Def, m_minBoxLength_Min, m_minBoxLength_Max);

        // 簡単設定テーブル
        int nTableSize = m_easySettingTable.Length;

        m_easyToleranceTable = new TessellationTolerance[nTableSize];
        for (int i = 0; i < nTableSize; ++i)
        {
            var easySetting = m_easySettingTable[i];
            var tole        = TessellationTolerance.Default;
            tole.TessAngle       = MoNo.Angle.FromDegree(easySetting.tessAngle);
            tole.TessAspectRatio = (easySetting.tessApectRatio == 0)
                             ? FSharpOption <TessellationAspectRatio> .None
                             : FSharpOption <TessellationAspectRatio> .Some(
                new TessellationAspectRatio()
            {
                MaxRatio  = easySetting.tessApectRatio,
                MinLength = FSharpOption <double> .None
            });

            m_easyToleranceTable[i] = tole;
        }

        // 初期値は真ん中で
        m_nEasyTessLevel = m_nLastEasyTessLevel = nTableSize / 2;
        var src = m_easyToleranceTable[m_nEasyTessLevel];

        m_tolerance = new TessellationTolerance()
        {
            TessAngle       = src.TessAngle,
            TessAspectRatio = src.TessAspectRatio,
            TessMaxLength   = src.TessMaxLength,
            TessDeviation   = src.TessDeviation
        };
    }