/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #ifndef CRYINCLUDE_CRYANIMATION_VERTEX_VERTEXCOMMAND_H #define CRYINCLUDE_CRYANIMATION_VERTEX_VERTEXCOMMAND_H #pragma once class CVertexData; struct VertexCommand; typedef void (* VertexCommandFunction)(VertexCommand&, CVertexData&); _MS_ALIGN(16) struct RecTangents { RecTangents() { t[0] = t[1] = t[2] = t[3] = 0.0f; n[0] = n[1] = n[2] = n[3] = 0.0f; }; float t[4]; float n[4]; } _ALIGN(16); // struct VertexCommand { private: friend class CVertexCommandBuffer; public: VertexCommand(VertexCommandFunction function) : Execute((VertexCommandFunction)function) { } private: VertexCommandFunction Execute; uint8 length; }; // struct VertexCommandCopy : public VertexCommand { public: strided_pointer pVertexPositions; strided_pointer pVertexColors; strided_pointer pVertexCoords; const vtx_idx* pIndices; public: VertexCommandCopy() : VertexCommand((VertexCommandFunction)Execute) , pVertexPositions(NULL) , pVertexColors(NULL) , pVertexCoords(NULL) , pIndices(NULL) { } public: static void Execute(VertexCommandCopy& command, CVertexData& vertexData); }; struct SSoftwareVertexFrame; struct VertexCommandAdd : public VertexCommand { public: VertexCommandAdd() : VertexCommand((VertexCommandFunction)Execute) , pVectors(NULL) , pIndices(NULL) , count(0) , weight(0.0f) { } public: static void Execute(VertexCommandAdd& command, CVertexData& vertexData); public: strided_pointer pVectors; strided_pointer pIndices; uint count; float weight; }; // struct VertexCommandSkin : public VertexCommand { public: VertexCommandSkin() : VertexCommand((VertexCommandFunction)Execute) , pTransformations(NULL) , pTransformationRemapTable(NULL) , transformationCount(0) , vertexTransformCount(0) { } public: static void Execute(VertexCommandSkin& command, CVertexData& vertexData); private: enum TemplateFlags { VELOCITY_VECTOR = 0x1, VELOCITY_ZERO = 0x2, }; template static void ExecuteInternal(VertexCommandSkin& command, CVertexData& vertexData); public: const DualQuat* pTransformations; const JointIdType* pTransformationRemapTable; uint transformationCount; strided_pointer pVertexPositions; strided_pointer pVertexPositionsPrevious; strided_pointer pVertexQTangents; strided_pointer pVertexTransformIndices; strided_pointer pVertexTransformWeights; uint vertexTransformCount; }; struct VertexCommandTangents : public VertexCommand { public: VertexCommandTangents() : VertexCommand((VertexCommandFunction)Execute) , pRecTangets(NULL) , pTangentUpdateData(NULL) , tangetUpdateDataCount(0) , pTangentUpdateVertIds(NULL) , tangetUpdateVertIdsCount(0) { } public: static void Execute(VertexCommandTangents& command, CVertexData& vertexData); public: RecTangents* pRecTangets; const STangentUpdateTriangles* pTangentUpdateData; uint tangetUpdateDataCount; const vtx_idx* pTangentUpdateVertIds; uint tangetUpdateVertIdsCount; }; #endif // CRYINCLUDE_CRYANIMATION_VERTEX_VERTEXCOMMAND_H