Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Client/App/App.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,10 @@
RelativePath=".\include\v8datamodel\Camera.h"
>
</File>
<File
RelativePath=".\include\v8datamodel\CustomMesh.h"
>
</File>
<File
RelativePath=".\include\v8datamodel\Decal.h"
>
Expand Down Expand Up @@ -1302,6 +1306,10 @@
RelativePath=".\v8datamodel\Camera.cpp"
>
</File>
<File
RelativePath=".\v8datamodel\CustomMesh.cpp"
>
</File>
<File
RelativePath=".\v8datamodel\Decal.cpp"
>
Expand Down Expand Up @@ -1388,7 +1396,6 @@
</File>
<File
RelativePath=".\gui\Widget.cpp"

>
</File>
</Filter>
Expand Down
66 changes: 66 additions & 0 deletions Client/App/include/v8datamodel/CustomMesh.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#pragma once

#include <G3D/Vector3.h>
#include "reflection/reflection.h"
#include "util/MeshId.h"
#include "util/TextureId.h"
#include "v8tree/Instance.h"

namespace RBX {
extern const char* sSpecialMesh;

class SpecialShape : public RBX::DescribedCreatable<SpecialShape, Instance, &sSpecialMesh>
{
public:
enum MeshType
{
HEAD_MESH,
TORSO_MESH,
WEDGE_MESH,
SPHERE_MESH,
CYLINDER_MESH,
FILE_MESH,
BRICK_MESH
};

private:
MeshType meshType;
G3D::Vector3 scale;
TextureId textureId;
MeshId meshId;
G3D::Vector3 vertColor;
public:
SpecialShape();
const MeshType getMeshType() const
{
return meshType;
}
void setMeshType(MeshType value);
const G3D::Vector3& getScale() const
{
return scale;
}
void setScale(const G3D::Vector3& value);
const G3D::Vector3& getVertColor() const
{
return vertColor;
}
void setVertColor(const G3D::Vector3& value);
const float getAlpha() const;

const MeshId getMeshId() const
{
return meshId;
}

void setMeshId(const MeshId& value);
const TextureId getTextureId() const
{
return textureId;
}
void setTextureId(const TextureId& value);
protected:
virtual bool askSetParent(const Instance*) const;
};

};
47 changes: 44 additions & 3 deletions Client/App/include/v8datamodel/Decal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
#include "reflection/reflection.h"
#include "v8datamodel/FaceInstance.h"
#include "util/TextureId.h"
#include <G3D/Vector2.h>

namespace RBX
{
extern const char* sDecal;
extern const char* sTexture;

class Decal : public DescribedCreatable<Decal,FaceInstance,&sDecal>
{
Expand All @@ -20,11 +22,50 @@ namespace RBX
static const Reflection::PropDescriptor<Decal, float> prop_Shiny;

Decal();
TextureId getTexture() const;
TextureId getTexture() const
{
return texture;
}

void setTexture(TextureId);
float getSpecular() const;

float getSpecular() const
{
return specular;
}

void setSpecular(float);
float getShiny() const;

float getShiny() const
{
return shiny;
}
void setShiny(float);
};

class Texture : public DescribedCreatable<Texture, Decal, &sTexture>
{
private:
G3D::Vector2 studsPerTile;
public:
static const Reflection::PropDescriptor<Texture, float> prop_StudsPerTileU;
static const Reflection::PropDescriptor<Texture, float> prop_StudsPerTileV;

Texture();
const G3D::Vector2& getStudsPerTile()
{
return studsPerTile;
}

float getStudsPerTileU() const
{
return studsPerTile.x;
}
void setStudsPerTileU(float value);
float getStudsPerTileV() const
{
return studsPerTile.y;
}
void setStudsPerTileV(float value);
};
};
5 changes: 4 additions & 1 deletion Client/App/include/v8datamodel/FaceInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ namespace RBX
public:
static const Reflection::EnumPropDescriptor<FaceInstance,NormalId> prop_Face;
FaceInstance();
NormalId getFace() const;
NormalId getFace() const
{
return face;
}
void setFace(NormalId);
protected:
virtual bool askSetParent(const Instance*) const;
Expand Down
95 changes: 95 additions & 0 deletions Client/App/v8datamodel/CustomMesh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#include "v8datamodel/CustomMesh.h"
#include "v8datamodel/PartInstance.h"
namespace RBX
{
const char* sSpecialMesh = "SpecialMesh";
static const Reflection::EnumPropDescriptor<SpecialShape, SpecialShape::MeshType> desc_meshType("MeshType", "Data", &SpecialShape::getMeshType, &SpecialShape::setMeshType, Reflection::EnumPropertyDescriptor::STANDARD);
static const Reflection::PropDescriptor<SpecialShape, G3D::Vector3> desc_scale("Scale", "Data", &SpecialShape::getScale, &SpecialShape::setScale, Reflection::PropertyDescriptor::STANDARD);
static const Reflection::PropDescriptor<SpecialShape, MeshId> desc_meshId("MeshId", "Data", &SpecialShape::getMeshId, &SpecialShape::setMeshId, Reflection::PropertyDescriptor::STANDARD);
static const Reflection::PropDescriptor<SpecialShape, TextureId> desc_textureId("TextureId", "Data", &SpecialShape::getTextureId, &SpecialShape::setTextureId, Reflection::PropertyDescriptor::STANDARD);
static const Reflection::PropDescriptor<SpecialShape, G3D::Vector3> desc_vertColor("VertexColor", "Data", &SpecialShape::getVertColor, &SpecialShape::setVertColor, Reflection::PropertyDescriptor::STANDARD);

const float SpecialShape::getAlpha() const
{
if (getParent())
{
PartInstance* part = fastDynamicCast<PartInstance>(getParent());

if (part)
{
return part->getTransparencyUi();
}
}
return 0.0f;
}

SpecialShape::SpecialShape()
: meshType(HEAD_MESH),
scale(1.0f, 1.0f, 1.0f),
textureId(),
meshId(),
vertColor(1.0f, 1.0f, 1.0f)
{
setName("Mesh");
}

void SpecialShape::setMeshType(MeshType value)
{
if (meshType != value)
{
meshType = value;
raisePropertyChanged(desc_meshType);
}
}

void SpecialShape::setScale(const G3D::Vector3& value)
{
if (scale != value)
{
scale = value;
raisePropertyChanged(desc_scale);
}
}

void SpecialShape::setVertColor(const G3D::Vector3& value)
{
if (vertColor != value)
{
vertColor = value;
raisePropertyChanged(desc_vertColor);
}
}

void SpecialShape::setMeshId(const MeshId& value)
{
if (meshId != value)
{
meshId = value;
raisePropertyChanged(desc_meshId);
if (meshType != FILE_MESH)
{
meshType = FILE_MESH;
raisePropertyChanged(desc_meshType);
}
}
}

void SpecialShape::setTextureId(const TextureId& value)
{
if (textureId != value)
{
textureId = value;
raisePropertyChanged(desc_textureId);
if (meshType != FILE_MESH)
{
meshType = FILE_MESH;
raisePropertyChanged(desc_meshType);
}
}
}

bool SpecialShape::askSetParent(const Instance* instance) const
{
return fastDynamicCast<const PartInstance>(instance) != NULL;
}
};
42 changes: 27 additions & 15 deletions Client/App/v8datamodel/Decal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
namespace RBX
{
const char* sDecal = "Decal";
const char* sTexture = "Texture";
const Reflection::PropDescriptor<Decal, TextureId> Decal::prop_Texture("Texture", "Appearance", &Decal::getTexture, &Decal::setTexture, Reflection::PropertyDescriptor::STANDARD);
const Reflection::PropDescriptor<Decal, float> Decal::prop_Specular("Specular", "Appearance", &Decal::getSpecular, &Decal::setSpecular, Reflection::PropertyDescriptor::STANDARD);
const Reflection::PropDescriptor<Decal, float> Decal::prop_Shiny("Shiny", "Appearance", &Decal::getShiny, &Decal::setShiny, Reflection::PropertyDescriptor::STANDARD);
const Reflection::PropDescriptor<Texture, float> Texture::prop_StudsPerTileU("StudsPerTileU", "Appearance", &Texture::getStudsPerTileU, &Texture::setStudsPerTileU, Reflection::PropertyDescriptor::STANDARD);
const Reflection::PropDescriptor<Texture, float> Texture::prop_StudsPerTileV("StudsPerTileV", "Appearance", &Texture::getStudsPerTileV, &Texture::setStudsPerTileV, Reflection::PropertyDescriptor::STANDARD);

Decal::Decal()
:texture(),
Expand All @@ -17,21 +20,6 @@ namespace RBX
{
setName("Decal");
}

float Decal::getShiny() const
{
return shiny;
}

float Decal::getSpecular() const
{
return specular;
};

TextureId Decal::getTexture() const
{
return texture;
}

void Decal::setTexture(TextureId value)
{
Expand Down Expand Up @@ -59,4 +47,28 @@ namespace RBX
raisePropertyChanged(prop_Shiny);
}
}

void Texture::setStudsPerTileU(float value)
{
if (studsPerTile.x != value && value > 0.0f)
{
studsPerTile.x = value;
raisePropertyChanged(prop_StudsPerTileU);
}
}

void Texture::setStudsPerTileV(float value)
{
if (studsPerTile.y != value && value > 0.0f)
{
studsPerTile.y = value;
raisePropertyChanged(prop_StudsPerTileV);
}
}

Texture::Texture()
: studsPerTile(2.0f, 2.0f)
{
setName("Texture");
}
};
6 changes: 0 additions & 6 deletions Client/App/v8datamodel/FaceInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ namespace RBX
}
}


NormalId FaceInstance::getFace() const
{
return face;
}

bool FaceInstance::askSetParent(const Instance* instance) const
{
return fastDynamicCast<const PartInstance>(instance) != NULL;
Expand Down
Loading