MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DrawMoveableAsStaticSorted

Method DrawMoveableAsStaticSorted

TombEngine/Renderer/RendererDraw.cpp:3932–3970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3930 }
3931
3932 void Renderer::DrawMoveableAsStaticSorted(RendererSortableObject* objectInfo, RendererObjectType lastObjectType, RenderView& view)
3933 {
3934 if (lastObjectType != objectInfo->ObjectType)
3935 {
3936 unsigned int stride = sizeof(Vertex);
3937 unsigned int offset = 0;
3938 _context->IASetVertexBuffers(0, 1, _moveablesVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
3939 _context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
3940 _context->IASetInputLayout(_inputLayout.Get());
3941
3942 SetDepthState(DepthState::Read);
3943 SetCullMode(CullMode::CounterClockwise);
3944
3945 _shaders.Bind(Shader::InstancedStatics);
3946 }
3947
3948 _sortedPolygonsIndexBuffer.Update(_context.Get(), _sortedPolygonsIndices, 0, (int)_sortedPolygonsIndices.size());
3949 _context->IASetIndexBuffer(_sortedPolygonsIndexBuffer.Buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
3950
3951 auto world = objectInfo->World;
3952 _stInstancedStaticMeshBuffer.StaticMeshes[0].World = world;
3953
3954 _stInstancedStaticMeshBuffer.StaticMeshes[0].Color = Vector4::One;
3955 _stInstancedStaticMeshBuffer.StaticMeshes[0].Ambient = objectInfo->Room->AmbientLight;
3956 _stInstancedStaticMeshBuffer.StaticMeshes[0].LightMode = (int)objectInfo->LightMode;
3957 BindInstancedStaticLights(objectInfo->Room->LightsToDraw, 0);
3958 UpdateConstantBuffer(_stInstancedStaticMeshBuffer, _cbInstancedStaticMeshBuffer);
3959
3960 SetBlendMode(objectInfo->BlendMode);
3961 SetAlphaTest(AlphaTestMode::GreatherThan, ALPHA_TEST_THRESHOLD);
3962
3963 BindBucketTextures(*objectInfo->Bucket, TextureSource::Statics, objectInfo->Bucket->Animated);
3964 BindMaterial(objectInfo->Bucket->MaterialIndex, false);
3965
3966 DrawIndexedInstancedTriangles((int)_sortedPolygonsIndices.size(), 1, 0, 0);
3967
3968 _numSortedStaticsDrawCalls++;
3969 _numSortedTriangles += (int)_sortedPolygonsIndices.size() / 3;
3970 }
3971
3972 void Renderer::DrawHairSorted(RendererSortableObject* objectInfo, RendererObjectType lastObjectType, RenderView& view, int index)
3973 {

Callers

nothing calls this directly

Calls 5

GetAddressOfMethod · 0.80
BindMethod · 0.80
GetMethod · 0.45
UpdateMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected