public CubismDrawableManager(IntPtr model)
            : base(model)
        {
            int count = CubismCore.csmGetDrawableCount(model);

            vertexCounts     = CubismUtils.PointerToIntArray(CubismCore.csmGetDrawableVertexCounts(model), count);
            texCoordPointers = CubismUtils.PointerToPointerArray(CubismCore.csmGetDrawableVertexUvs(model), count);

            indexCounts   = CubismUtils.PointerToIntArray(CubismCore.csmGetDrawableIndexCounts(model), count);
            indexPointers = CubismUtils.PointerToPointerArray(CubismCore.csmGetDrawableIndices(model), count);

            int[]    textureIds = CubismUtils.PointerToIntArray(CubismCore.csmGetDrawableTextureIndices(model), count);
            byte[]   constFlags = CubismUtils.PointerToByteArray(CubismCore.csmGetDrawableConstantFlags(model), count);
            string[] names      = CubismUtils.PointerToStringArray(CubismCore.csmGetDrawableIds(model), count);

            int[]    maskCounts   = CubismUtils.PointerToIntArray(CubismCore.csmGetDrawableMaskCounts(model), count);
            IntPtr[] maskPointers = CubismUtils.PointerToPointerArray(CubismCore.csmGetDrawableMasks(model), count);

            for (int i = 0; i < count; i++)
            {
                float[] texCoords = CubismUtils.PointerToFloatArray(texCoordPointers[i], vertexCounts[i] * 2);
                short[] indices   = CubismUtils.PointerToShortArray(indexPointers[i], indexCounts[i]);
                int[]   masks     = CubismUtils.PointerToIntArray(maskPointers[i], maskCounts[i]);
                Add(new CubismDrawable(i, names[i], textureIds[i], masks, texCoords, indices, (ConstantDrawableFlags)constFlags[i]));
            }
        }
예제 #2
0
        public CubismPartManager(IntPtr model)
            : base(model)
        {
            handle = CubismCore.csmGetPartOpacities(model);

            int count = CubismCore.csmGetPartCount(model);

            string[] names = CubismUtils.PointerToStringArray(CubismCore.csmGetPartIds(model), count);

            for (int i = 0; i < count; i++)
            {
                Add(new CubismPart(i, names[i]));
            }
        }
        public CubismParameterManager(IntPtr model)
            : base(model)
        {
            handle = CubismCore.csmGetParameterValues(model);

            int count = CubismCore.csmGetParameterCount(model);

            float[]  def   = CubismUtils.PointerToFloatArray(CubismCore.csmGetParameterDefaultValues(model), count);
            float[]  min   = CubismUtils.PointerToFloatArray(CubismCore.csmGetParameterMinimumValues(model), count);
            float[]  max   = CubismUtils.PointerToFloatArray(CubismCore.csmGetParameterMaximumValues(model), count);
            string[] names = CubismUtils.PointerToStringArray(CubismCore.csmGetParameterIds(model), count);

            for (int i = 0; i < count; i++)
            {
                Add(new CubismParameter(i, names[i], min[i], max[i], def[i]));
            }
        }