Added Unpickable component, which skips the entity in the PickingPass

This commit is contained in:
viktorljung
2016-03-10 16:29:13 +01:00
parent 777f382772
commit b3ea26779a
6 changed files with 28 additions and 1 deletions
+7 -1
View File
@@ -121,12 +121,17 @@ struct ModelJob : RenderJob
FillPercentage = fillPercentage;
IsShielded = isShielded;
if (world->HasComponent(Entity, "Unpickable")) {
NotPickable = true;
}
if (model->IsSkinned()) {
Skeleton = Model->m_RawModel->m_Skeleton;
if (Skeleton != nullptr) {
EntityWrapper entityWrapper = EntityWrapper(world, modelComponent.EntityID);
if(Skeleton->BlendTrees.find(entityWrapper) != Skeleton->BlendTrees.end()) {
BlendTree = Skeleton->BlendTrees.at(entityWrapper);
@@ -164,6 +169,7 @@ struct ModelJob : RenderJob
float FillPercentage = 0.0;
bool IsShielded;
bool Shadow;
bool NotPickable = false;
void CalculateHash() override
{
+1
View File
@@ -68,4 +68,5 @@
<xs:include schemaLocation="Components/NetworkComponent.xsd"/>
<xs:include schemaLocation="Components/ServerIdentity.xsd"/>
<xs:include schemaLocation="Components/ServerList.xsd"/>
<xs:include schemaLocation="Components/Unpickable.xsd"/>
</xs:schema>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Unpickable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Unpickable.xsd">
</Unpickable>
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="Unpickable">
<xs:annotation>
<xs:documentation>Makes the entity unpickable</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
+1
View File
@@ -71,6 +71,7 @@
<xs:element ref="c:NetworkComponent" minOccurs="0"/>
<xs:element ref="c:ServerIdentity" minOccurs="0"/>
<xs:element ref="c:ServerList" minOccurs="0"/>
<xs:element ref="c:Unpickable" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
+5
View File
@@ -76,6 +76,11 @@ void PickingPass::Draw(RenderScene& scene)
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
if (modelJob) {
if(modelJob->NotPickable) {
continue;
}
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
PickingInfo pickInfo;