示例#1
0
    private void SaveSkinningData()
    {
        int weightCount = SkinningComponentCount;

        _vtxBoneWeightsRange = mBinary.AllocateRange(mMesh.boneWeights.Length * weightCount * sizeof(float));
        _vtxBoneIndicesRange = mBinary.AllocateRange(mMesh.boneWeights.Length * weightCount * sizeof(byte));

        foreach (var weight in mMesh.boneWeights)
        {
            _vtxBoneWeightsRange.Write(weight.weight0);
            _vtxBoneIndicesRange.Write((byte)weight.boneIndex0);

            if (weightCount >= 2)
            {
                _vtxBoneWeightsRange.Write(weight.weight1);
                _vtxBoneIndicesRange.Write((byte)weight.boneIndex1);

                if (weightCount >= 4)
                {
                    _vtxBoneWeightsRange.Write(weight.weight2);
                    _vtxBoneWeightsRange.Write(weight.weight3);
                    _vtxBoneIndicesRange.Write((byte)weight.boneIndex2);
                    _vtxBoneIndicesRange.Write((byte)weight.boneIndex3);
                }
            }
        }
    }
示例#2
0
    private void SaveVertexColors()
    {
        _vtxColorsRange = mBinary.AllocateRange(mMesh.colors.Length * sizeof(float) * 4);
        foreach (var color in mMesh.colors)
        {
            // TEMP HACK
            _vtxColorsRange.Write(1.0f); _vtxColorsRange.Write(1.0f); _vtxColorsRange.Write(1.0f); _vtxColorsRange.Write(1.0f);

            /*
             * _vtxColorsRange.Write(color.r);
             * _vtxColorsRange.Write(color.g);
             * _vtxColorsRange.Write(color.b);
             * _vtxColorsRange.Write(color.a);
             */
        }
    }
    public void AddToBinary(GooBinary pBinary)
    {
        PostprocessCurveData();

        _transRange = pBinary.Add(_translationKeyframes);
        _scaleRange = pBinary.Add(_scaleKeyframes);

        _rotRange = pBinary.AllocateRange(sizeof(float) * 4 * _rotationKeyframes.Length);
        foreach (var rotQuat in _rotationKeyframes)
        {
            _rotRange.Write(rotQuat[0]);
            _rotRange.Write(rotQuat[1]);
            _rotRange.Write(rotQuat[2]);
            _rotRange.Write(rotQuat[3]);
        }

        _timesRange = pBinary.AllocateRange(sizeof(float) * _clip.KeyframeCount);
        for (int i = 0; i < _clip.KeyframeCount; ++i)
        {
            _timesRange.Write(_clip.GetTimeAtKeyframe(i));
        }
    }
    public void AddToBinary(GooBinary pBinary)
    {
        PostprocessCurveData();

        _transRange = pBinary.Add(_translationKeyframes);
        _scaleRange = pBinary.Add(_scaleKeyframes);

        _rotRange = pBinary.AllocateRange(sizeof(float) * 4 * _rotationKeyframes.Length);
        foreach (var rotQuat in _rotationKeyframes) {
            _rotRange.Write(rotQuat[0]);
            _rotRange.Write(rotQuat[1]);
            _rotRange.Write(rotQuat[2]);
            _rotRange.Write(rotQuat[3]);
        }

        _timesRange = pBinary.AllocateRange(sizeof(float) * _clip.KeyframeCount);
        for (int i = 0; i < _clip.KeyframeCount; ++i) {
            _timesRange.Write(_clip.GetTimeAtKeyframe(i));
        }
    }
    private void SaveVertexColors()
    {
        _vtxColorsRange = mBinary.AllocateRange(mMesh.colors.Length * sizeof(float) * 4);
        foreach (var color in mMesh.colors) {

            // TEMP HACK
            _vtxColorsRange.Write(1.0f); _vtxColorsRange.Write(1.0f); _vtxColorsRange.Write(1.0f); _vtxColorsRange.Write(1.0f);

            /*
            _vtxColorsRange.Write(color.r);
            _vtxColorsRange.Write(color.g);
            _vtxColorsRange.Write(color.b);
            _vtxColorsRange.Write(color.a);
            */
        }
    }
    private void SaveSkinningData()
    {
        int weightCount = SkinningComponentCount;

        _vtxBoneWeightsRange = mBinary.AllocateRange(mMesh.boneWeights.Length * weightCount * sizeof(float));
        _vtxBoneIndicesRange = mBinary.AllocateRange(mMesh.boneWeights.Length * weightCount * sizeof(byte));

        foreach (var weight in mMesh.boneWeights) {
            _vtxBoneWeightsRange.Write(weight.weight0);
            _vtxBoneIndicesRange.Write((byte)weight.boneIndex0);

            if (weightCount >= 2) {
                _vtxBoneWeightsRange.Write(weight.weight1);
                _vtxBoneIndicesRange.Write((byte)weight.boneIndex1);

                if (weightCount >= 4) {
                    _vtxBoneWeightsRange.Write(weight.weight2);
                    _vtxBoneWeightsRange.Write(weight.weight3);
                    _vtxBoneIndicesRange.Write((byte)weight.boneIndex2);
                    _vtxBoneIndicesRange.Write((byte)weight.boneIndex3);
                }
            }
        }
    }