| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662 |
- //
- // Copyright (c) 2008-2017 the Urho3D project.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy
- // of this software and associated documentation files (the "Software"), to deal
- // in the Software without restriction, including without limitation the rights
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- // copies of the Software, and to permit persons to whom the Software is
- // furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in
- // all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- // THE SOFTWARE.
- //
- #include "../Precompiled.h"
- #include "../Core/Context.h"
- #include "../Graphics/Camera.h"
- #include "../Graphics/DebugRenderer.h"
- #include "../IO/File.h"
- #include "../Graphics/Geometry.h"
- #include "../Graphics/Material.h"
- #include "../Graphics/Octree.h"
- #include "../Graphics/Renderer.h"
- #include "../Graphics/VertexBuffer.h"
- #include "../Graphics/Zone.h"
- #include "../IO/Log.h"
- #include "../Scene/Scene.h"
- // ATOMIC BEGIN
- #include "../IO/Log.h"
- // ATOMIC END
- #include "../DebugNew.h"
- #ifdef _MSC_VER
- #pragma warning(disable:6293)
- #endif
- namespace Atomic
- {
- const char* GEOMETRY_CATEGORY = "Geometry";
- SourceBatch::SourceBatch() :
- distance_(0.0f),
- geometry_(0),
- worldTransform_(&Matrix3x4::IDENTITY),
- numWorldTransforms_(1),
- instancingData_((void*)0),
- geometryType_(GEOM_STATIC)
- {
- }
- SourceBatch::SourceBatch(const SourceBatch& batch)
- {
- *this = batch;
- }
- SourceBatch::~SourceBatch()
- {
- }
- SourceBatch& SourceBatch::operator =(const SourceBatch& rhs)
- {
- distance_ = rhs.distance_;
- geometry_ = rhs.geometry_;
- material_ = rhs.material_;
- worldTransform_ = rhs.worldTransform_;
- numWorldTransforms_ = rhs.numWorldTransforms_;
- instancingData_ = rhs.instancingData_;
- geometryType_ = rhs.geometryType_;
- return *this;
- }
- Drawable::Drawable(Context* context, unsigned char drawableFlags) :
- Component(context),
- boundingBox_(0.0f, 0.0f),
- drawableFlags_(drawableFlags),
- worldBoundingBoxDirty_(true),
- castShadows_(false),
- occluder_(false),
- occludee_(true),
- updateQueued_(false),
- zoneDirty_(false),
- octant_(0),
- zone_(0),
- viewMask_(DEFAULT_VIEWMASK),
- lightMask_(DEFAULT_LIGHTMASK),
- shadowMask_(DEFAULT_SHADOWMASK),
- zoneMask_(DEFAULT_ZONEMASK),
- viewFrameNumber_(0),
- distance_(0.0f),
- lodDistance_(0.0f),
- drawDistance_(0.0f),
- shadowDistance_(0.0f),
- sortValue_(0.0f),
- minZ_(0.0f),
- maxZ_(0.0f),
- lodBias_(1.0f),
- basePassFlags_(0),
- maxLights_(0),
- firstLight_(0)
- {
- // ATOMIC BEGIN
- if (drawableFlags == DRAWABLE_UNDEFINED || drawableFlags > DRAWABLE_ANY)
- {
- ATOMIC_LOGERROR("Drawable with undefined drawableFlags");
- }
- // ATOMIC END
- }
- Drawable::~Drawable()
- {
- RemoveFromOctree();
- }
- void Drawable::RegisterObject(Context* context)
- {
- ATOMIC_ATTRIBUTE("Max Lights", int, maxLights_, 0, AM_DEFAULT);
- ATOMIC_ATTRIBUTE("View Mask", int, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
- ATOMIC_ATTRIBUTE("Light Mask", int, lightMask_, DEFAULT_LIGHTMASK, AM_DEFAULT);
- ATOMIC_ATTRIBUTE("Shadow Mask", int, shadowMask_, DEFAULT_SHADOWMASK, AM_DEFAULT);
- ATOMIC_ACCESSOR_ATTRIBUTE("Zone Mask", GetZoneMask, SetZoneMask, unsigned, DEFAULT_ZONEMASK, AM_DEFAULT);
- }
- void Drawable::OnSetEnabled()
- {
- bool enabled = IsEnabledEffective();
- if (enabled && !octant_)
- AddToOctree();
- else if (!enabled && octant_)
- RemoveFromOctree();
- }
- void Drawable::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
- {
- float distance = query.ray_.HitDistance(GetWorldBoundingBox());
- if (distance < query.maxDistance_)
- {
- RayQueryResult result;
- result.position_ = query.ray_.origin_ + distance * query.ray_.direction_;
- result.normal_ = -query.ray_.direction_;
- result.distance_ = distance;
- result.drawable_ = this;
- result.node_ = GetNode();
- result.subObject_ = M_MAX_UNSIGNED;
- results.Push(result);
- }
- }
- void Drawable::UpdateBatches(const FrameInfo& frame)
- {
- const BoundingBox& worldBoundingBox = GetWorldBoundingBox();
- const Matrix3x4& worldTransform = node_->GetWorldTransform();
- distance_ = frame.camera_->GetDistance(worldBoundingBox.Center());
- for (unsigned i = 0; i < batches_.Size(); ++i)
- {
- batches_[i].distance_ = distance_;
- batches_[i].worldTransform_ = &worldTransform;
- }
- float scale = worldBoundingBox.Size().DotProduct(DOT_SCALE);
- float newLodDistance = frame.camera_->GetLodDistance(distance_, scale, lodBias_);
- if (newLodDistance != lodDistance_)
- lodDistance_ = newLodDistance;
- }
- Geometry* Drawable::GetLodGeometry(unsigned batchIndex, unsigned level)
- {
- // By default return the visible batch geometry
- if (batchIndex < batches_.Size())
- return batches_[batchIndex].geometry_;
- else
- return 0;
- }
- bool Drawable::DrawOcclusion(OcclusionBuffer* buffer)
- {
- return true;
- }
- void Drawable::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
- {
- if (debug && IsEnabledEffective())
- debug->AddBoundingBox(GetWorldBoundingBox(), Color::GREEN, depthTest);
- }
- void Drawable::SetDrawDistance(float distance)
- {
- drawDistance_ = distance;
- MarkNetworkUpdate();
- }
- void Drawable::SetShadowDistance(float distance)
- {
- shadowDistance_ = distance;
- MarkNetworkUpdate();
- }
- void Drawable::SetLodBias(float bias)
- {
- lodBias_ = Max(bias, M_EPSILON);
- MarkNetworkUpdate();
- }
- void Drawable::SetViewMask(unsigned mask)
- {
- viewMask_ = mask;
- MarkNetworkUpdate();
- }
- void Drawable::SetLightMask(unsigned mask)
- {
- lightMask_ = mask;
- MarkNetworkUpdate();
- }
- void Drawable::SetShadowMask(unsigned mask)
- {
- shadowMask_ = mask;
- MarkNetworkUpdate();
- }
- void Drawable::SetZoneMask(unsigned mask)
- {
- zoneMask_ = mask;
- // Mark dirty to reset cached zone
- OnMarkedDirty(node_);
- MarkNetworkUpdate();
- }
- void Drawable::SetMaxLights(unsigned num)
- {
- maxLights_ = num;
- MarkNetworkUpdate();
- }
- void Drawable::SetCastShadows(bool enable)
- {
- castShadows_ = enable;
- MarkNetworkUpdate();
- }
- void Drawable::SetOccluder(bool enable)
- {
- occluder_ = enable;
- MarkNetworkUpdate();
- }
- void Drawable::SetOccludee(bool enable)
- {
- if (enable != occludee_)
- {
- occludee_ = enable;
- // Reinsert to octree to make sure octant occlusion does not erroneously hide this drawable
- if (octant_ && !updateQueued_)
- octant_->GetRoot()->QueueUpdate(this);
- MarkNetworkUpdate();
- }
- }
- void Drawable::MarkForUpdate()
- {
- if (!updateQueued_ && octant_)
- octant_->GetRoot()->QueueUpdate(this);
- }
- const BoundingBox& Drawable::GetWorldBoundingBox()
- {
- if (worldBoundingBoxDirty_)
- {
- OnWorldBoundingBoxUpdate();
- worldBoundingBoxDirty_ = false;
- }
- return worldBoundingBox_;
- }
- bool Drawable::IsInView() const
- {
- // Note: in headless mode there is no renderer subsystem and no view frustum tests are performed, so return
- // always false in that case
- Renderer* renderer = GetSubsystem<Renderer>();
- return renderer && viewFrameNumber_ == renderer->GetFrameInfo().frameNumber_ && !viewCameras_.Empty();
- }
- bool Drawable::IsInView(Camera* camera) const
- {
- Renderer* renderer = GetSubsystem<Renderer>();
- return renderer && viewFrameNumber_ == renderer->GetFrameInfo().frameNumber_ && (!camera || viewCameras_.Contains(camera));
- }
- bool Drawable::IsInView(const FrameInfo& frame, bool anyCamera) const
- {
- return viewFrameNumber_ == frame.frameNumber_ && (anyCamera || viewCameras_.Contains(frame.camera_));
- }
- void Drawable::SetZone(Zone* zone, bool temporary)
- {
- zone_ = zone;
- // If the zone assignment was temporary (inconclusive) set the dirty flag so that it will be re-evaluated on the next frame
- zoneDirty_ = temporary;
- }
- void Drawable::SetSortValue(float value)
- {
- sortValue_ = value;
- }
- void Drawable::MarkInView(const FrameInfo& frame)
- {
- if (frame.frameNumber_ != viewFrameNumber_)
- {
- viewFrameNumber_ = frame.frameNumber_;
- viewCameras_.Resize(1);
- viewCameras_[0] = frame.camera_;
- }
- else
- viewCameras_.Push(frame.camera_);
- basePassFlags_ = 0;
- firstLight_ = 0;
- lights_.Clear();
- vertexLights_.Clear();
- }
- void Drawable::MarkInView(unsigned frameNumber)
- {
- if (frameNumber != viewFrameNumber_)
- {
- viewFrameNumber_ = frameNumber;
- viewCameras_.Clear();
- }
- }
- void Drawable::LimitLights()
- {
- // Maximum lights value 0 means unlimited
- if (!maxLights_ || lights_.Size() <= maxLights_)
- return;
- // If more lights than allowed, move to vertex lights and cut the list
- const BoundingBox& box = GetWorldBoundingBox();
- for (unsigned i = 0; i < lights_.Size(); ++i)
- lights_[i]->SetIntensitySortValue(box);
- Sort(lights_.Begin(), lights_.End(), CompareDrawables);
- vertexLights_.Insert(vertexLights_.End(), lights_.Begin() + maxLights_, lights_.End());
- lights_.Resize(maxLights_);
- }
- void Drawable::LimitVertexLights(bool removeConvertedLights)
- {
- if (removeConvertedLights)
- {
- for (unsigned i = vertexLights_.Size() - 1; i < vertexLights_.Size(); --i)
- {
- if (!vertexLights_[i]->GetPerVertex())
- vertexLights_.Erase(i);
- }
- }
- if (vertexLights_.Size() <= MAX_VERTEX_LIGHTS)
- return;
- const BoundingBox& box = GetWorldBoundingBox();
- for (unsigned i = 0; i < vertexLights_.Size(); ++i)
- vertexLights_[i]->SetIntensitySortValue(box);
- Sort(vertexLights_.Begin(), vertexLights_.End(), CompareDrawables);
- vertexLights_.Resize(MAX_VERTEX_LIGHTS);
- }
- void Drawable::OnNodeSet(Node* node)
- {
- if (node)
- node->AddListener(this);
- }
- void Drawable::OnSceneSet(Scene* scene)
- {
- if (scene)
- AddToOctree();
- else
- RemoveFromOctree();
- }
- void Drawable::OnMarkedDirty(Node* node)
- {
- worldBoundingBoxDirty_ = true;
- if (!updateQueued_ && octant_)
- octant_->GetRoot()->QueueUpdate(this);
- // Mark zone assignment dirty when transform changes
- if (node == node_)
- zoneDirty_ = true;
- }
- void Drawable::AddToOctree()
- {
- // Do not add to octree when disabled
- if (!IsEnabledEffective())
- return;
- Scene* scene = GetScene();
- if (scene)
- {
- Octree* octree = scene->GetComponent<Octree>();
- if (octree)
- octree->InsertDrawable(this);
- else
- ATOMIC_LOGERROR("No Octree component in scene, drawable will not render");
- }
- else
- {
- // We have a mechanism for adding detached nodes to an octree manually, so do not log this error
- //ATOMIC_LOGERROR("Node is detached from scene, drawable will not render");
- }
- }
- void Drawable::RemoveFromOctree()
- {
- if (octant_)
- {
- Octree* octree = octant_->GetRoot();
- if (updateQueued_)
- octree->CancelUpdate(this);
- // Perform subclass specific deinitialization if necessary
- OnRemoveFromOctree();
- octant_->RemoveDrawable(this);
- }
- }
- bool WriteDrawablesToOBJ(PODVector<Drawable*> drawables, File* outputFile, bool asZUp, bool asRightHanded, bool writeLightmapUV)
- {
- // Must track indices independently to deal with potential mismatching of drawables vertex attributes (ie. one with UV, another without, then another with)
- unsigned currentPositionIndex = 1;
- unsigned currentUVIndex = 1;
- unsigned currentNormalIndex = 1;
- bool anythingWritten = false;
- // Write the common "I came from X" comment
- outputFile->WriteLine("# OBJ file exported from Atomic");
- for (unsigned i = 0; i < drawables.Size(); ++i)
- {
- Drawable* drawable = drawables[i];
- // Only write enabled drawables
- if (!drawable->IsEnabledEffective())
- continue;
- Node* node = drawable->GetNode();
- Matrix3x4 transMat = drawable->GetNode()->GetWorldTransform();
- Matrix3x4 n = transMat.Inverse();
- Matrix3 normalMat = Matrix3(n.m00_, n.m01_, n.m02_, n.m10_, n.m11_, n.m12_, n.m20_, n.m21_, n.m22_);
- normalMat = normalMat.Transpose();
- const Vector<SourceBatch>& batches = drawable->GetBatches();
- for (unsigned geoIndex = 0; geoIndex < batches.Size(); ++geoIndex)
- {
- Geometry* geo = drawable->GetLodGeometry(geoIndex, 0);
- if (geo == 0)
- continue;
- if (geo->GetPrimitiveType() != TRIANGLE_LIST)
- {
- ATOMIC_LOGERRORF("%s (%u) %s (%u) Geometry %u contains an unsupported geometry type %u", node->GetName().Length() > 0 ? node->GetName().CString() : "Node", node->GetID(), drawable->GetTypeName().CString(), drawable->GetID(), geoIndex, (unsigned)geo->GetPrimitiveType());
- continue;
- }
- // If we've reached here than we're going to actually write something to the OBJ file
- anythingWritten = true;
- const unsigned char* vertexData;
- const unsigned char* indexData;
- unsigned elementSize, indexSize;
- const PODVector<VertexElement>* elements;
- geo->GetRawData(vertexData, elementSize, indexData, indexSize, elements);
- if (!vertexData || !elements)
- continue;
- bool hasPosition = VertexBuffer::HasElement(*elements, TYPE_VECTOR3, SEM_POSITION);
- if (!hasPosition)
- {
- ATOMIC_LOGERRORF("%s (%u) %s (%u) Geometry %u contains does not have Vector3 type positions in vertex data", node->GetName().Length() > 0 ? node->GetName().CString() : "Node", node->GetID(), drawable->GetTypeName().CString(), drawable->GetID(), geoIndex);
- continue;
- }
- bool hasNormals = VertexBuffer::HasElement(*elements, TYPE_VECTOR3, SEM_NORMAL);
- bool hasUV = VertexBuffer::HasElement(*elements, TYPE_VECTOR2, SEM_TEXCOORD, 0);
- bool hasLMUV = VertexBuffer::HasElement(*elements, TYPE_VECTOR2, SEM_TEXCOORD, 1);
- if (elementSize > 0 && indexSize > 0)
- {
- unsigned vertexStart = geo->GetVertexStart();
- unsigned vertexCount = geo->GetVertexCount();
- unsigned indexStart = geo->GetIndexStart();
- unsigned indexCount = geo->GetIndexCount();
- // Name NodeID DrawableType DrawableID GeometryIndex ("Geo" is included for clarity as StaticModel_32_2 could easily be misinterpreted or even quickly misread as 322)
- // Generated object name example: Node_5_StaticModel_32_Geo_0 ... or ... Bob_5_StaticModel_32_Geo_0
- outputFile->WriteLine(String("o ").AppendWithFormat("%s_%u_%s_%u_Geo_%u", node->GetName().Length() > 0 ? node->GetName().CString() : "Node", node->GetID(), drawable->GetTypeName().CString(), drawable->GetID(), geoIndex));
- // Write vertex position
- unsigned positionOffset = VertexBuffer::GetElementOffset(*elements, TYPE_VECTOR3, SEM_POSITION);
- for (unsigned j = 0; j < vertexCount; ++j)
- {
- Vector3 vertexPosition = *((const Vector3*)(&vertexData[(vertexStart + j) * elementSize + positionOffset]));
- vertexPosition = transMat * vertexPosition;
- // Convert coordinates as requested
- if (asRightHanded)
- vertexPosition.x_ *= -1;
- if (asZUp)
- {
- float yVal = vertexPosition.y_;
- vertexPosition.y_ = vertexPosition.z_;
- vertexPosition.z_ = yVal;
- }
- outputFile->WriteLine("v " + String(vertexPosition));
- }
- if (hasNormals)
- {
- unsigned normalOffset = VertexBuffer::GetElementOffset(*elements, TYPE_VECTOR3, SEM_NORMAL);
- for (unsigned j = 0; j < vertexCount; ++j)
- {
- Vector3 vertexNormal = *((const Vector3*)(&vertexData[(vertexStart + j) * elementSize + normalOffset]));
- vertexNormal = normalMat * vertexNormal;
- vertexNormal.Normalize();
- if (asRightHanded)
- vertexNormal.x_ *= -1;
- if (asZUp)
- {
- float yVal = vertexNormal.y_;
- vertexNormal.y_ = vertexNormal.z_;
- vertexNormal.z_ = yVal;
- }
- outputFile->WriteLine("vn " + String(vertexNormal));
- }
- }
- // Write TEXCOORD1 or TEXCOORD2 if it was chosen
- if (hasUV || (hasLMUV && writeLightmapUV))
- {
- // if writing Lightmap UV is chosen, only use it if TEXCOORD2 exists, otherwise use TEXCOORD1
- unsigned texCoordOffset = (writeLightmapUV && hasLMUV) ? VertexBuffer::GetElementOffset(*elements, TYPE_VECTOR2, SEM_TEXCOORD, 1) :
- VertexBuffer::GetElementOffset(*elements, TYPE_VECTOR2, SEM_TEXCOORD, 0);
- for (unsigned j = 0; j < vertexCount; ++j)
- {
- Vector2 uvCoords = *((const Vector2*)(&vertexData[(vertexStart + j) * elementSize + texCoordOffset]));
- outputFile->WriteLine("vt " + String(uvCoords));
- }
- }
- // If we don't have UV but have normals then must write a double-slash to indicate the absence of UV coords, otherwise use a single slash
- const String slashCharacter = hasNormals ? "//" : "/";
- // Amount by which to offset indices in the OBJ vs their values in the Urho3D geometry, basically the lowest index value
- // Compensates for the above vertex writing which doesn't write ALL vertices, just the used ones
- unsigned indexOffset = M_MAX_INT;
- for (unsigned indexIdx = indexStart; indexIdx < indexStart + indexCount; indexIdx++)
- {
- if (indexSize == 2)
- indexOffset = Min(indexOffset, (unsigned)*((unsigned short*)(indexData + indexIdx * indexSize)));
- else
- indexOffset = Min(indexOffset, *((unsigned*)(indexData + indexIdx * indexSize)));
- }
- for (unsigned indexIdx = indexStart; indexIdx < indexStart + indexCount; indexIdx += 3)
- {
- // Deal with 16 or 32 bit indices
- unsigned longIndices[3];
- if (indexSize == 2)
- {
- //16 bit indices
- unsigned short indices[3];
- memcpy(indices, indexData + (indexIdx * indexSize), indexSize * 3);
- longIndices[0] = indices[0] - indexOffset;
- longIndices[1] = indices[1] - indexOffset;
- longIndices[2] = indices[2] - indexOffset;
- }
- else
- {
- //32 bit indices
- unsigned indices[3];
- memcpy(indices, indexData + (indexIdx * indexSize), indexSize * 3);
- longIndices[0] = indices[0] - indexOffset;
- longIndices[1] = indices[1] - indexOffset;
- longIndices[2] = indices[2] - indexOffset;
- }
- String output = "f ";
- if (hasNormals)
- {
- output.AppendWithFormat("%l/%l/%l %l/%l/%l %l/%l/%l",
- currentPositionIndex + longIndices[0],
- currentUVIndex + longIndices[0],
- currentNormalIndex + longIndices[0],
- currentPositionIndex + longIndices[1],
- currentUVIndex + longIndices[1],
- currentNormalIndex + longIndices[1],
- currentPositionIndex + longIndices[2],
- currentUVIndex + longIndices[2],
- currentNormalIndex + longIndices[2]);
- }
- else if (hasNormals || hasUV)
- {
- unsigned secondTraitIndex = hasNormals ? currentNormalIndex : currentUVIndex;
- output.AppendWithFormat("%l%s%l %l%s%l %l%s%l",
- currentPositionIndex + longIndices[0],
- slashCharacter.CString(),
- secondTraitIndex + longIndices[0],
- currentPositionIndex + longIndices[1],
- slashCharacter.CString(),
- secondTraitIndex + longIndices[1],
- currentPositionIndex + longIndices[2],
- slashCharacter.CString(),
- secondTraitIndex + longIndices[2]);
- }
- else
- {
- output.AppendWithFormat("%l %l %l",
- currentPositionIndex + longIndices[0],
- currentPositionIndex + longIndices[1],
- currentPositionIndex + longIndices[2]);
- }
- outputFile->WriteLine(output);
- }
- // Increment our positions based on what vertex attributes we have
- currentPositionIndex += vertexCount;
- currentNormalIndex += hasNormals ? vertexCount : 0;
- // is it possible to have TEXCOORD2 but not have TEXCOORD1, assume anything
- currentUVIndex += (hasUV || hasLMUV) ? vertexCount : 0;
- }
- }
- }
- return anythingWritten;
- }
- }
|