rename model:: -> graphics::

This commit is contained in:
humbletim 2018-01-16 12:46:16 -05:00
parent 08ccda9cfc
commit b91d536dd0
71 changed files with 340 additions and 340 deletions

View file

@ -5465,7 +5465,7 @@ void Application::clearDomainOctreeDetails() {
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT);
skyStage->setBackgroundMode(graphics::SunSkyStage::SKY_DEFAULT);
DependencyManager::get<AnimationCache>()->clearUnusedResources();
DependencyManager::get<ModelCache>()->clearUnusedResources();

View file

@ -270,7 +270,7 @@ public:
void takeSecondaryCameraSnapshot();
void shareSnapshot(const QString& filename, const QUrl& href = QUrl(""));
model::SkyboxPointer getDefaultSkybox() const { return _defaultSkybox; }
graphics::SkyboxPointer getDefaultSkybox() const { return _defaultSkybox; }
gpu::TexturePointer getDefaultSkyboxTexture() const { return _defaultSkyboxTexture; }
gpu::TexturePointer getDefaultSkyboxAmbientTexture() const { return _defaultSkyboxAmbientTexture; }
@ -667,7 +667,7 @@ private:
ConnectionMonitor _connectionMonitor;
model::SkyboxPointer _defaultSkybox { new ProceduralSkybox() } ;
graphics::SkyboxPointer _defaultSkybox { new ProceduralSkybox() } ;
gpu::TexturePointer _defaultSkyboxTexture;
gpu::TexturePointer _defaultSkyboxAmbientTexture;

View file

@ -52,9 +52,9 @@ void LightEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint
float exponent = entity->getExponent();
float cutoff = glm::radians(entity->getCutoff());
if (!entity->getIsSpotlight()) {
light->setType(model::Light::POINT);
light->setType(graphics::Light::POINT);
} else {
light->setType(model::Light::SPOT);
light->setType(graphics::Light::SPOT);
light->setSpotAngle(cutoff);
light->setSpotExponent(exponent);

View file

@ -558,10 +558,10 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) {
if (type == SHAPE_TYPE_STATIC_MESH) {
// copy into triangleIndices
triangleIndices.reserve((int32_t)((gpu::Size)(triangleIndices.size()) + indices.getNumElements()));
gpu::BufferView::Iterator<const model::Mesh::Part> partItr = parts.cbegin<const model::Mesh::Part>();
while (partItr != parts.cend<const model::Mesh::Part>()) {
gpu::BufferView::Iterator<const graphics::Mesh::Part> partItr = parts.cbegin<const graphics::Mesh::Part>();
while (partItr != parts.cend<const graphics::Mesh::Part>()) {
auto numIndices = partItr->_numIndices;
if (partItr->_topology == model::Mesh::TRIANGLES) {
if (partItr->_topology == graphics::Mesh::TRIANGLES) {
// TODO: assert rather than workaround after we start sanitizing FBXMesh higher up
//assert(numIndices % TRIANGLE_STRIDE == 0);
numIndices -= numIndices % TRIANGLE_STRIDE; // WORKAROUND lack of sanity checking in FBXReader
@ -572,7 +572,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) {
triangleIndices.push_back(*indexItr + meshIndexOffset);
++indexItr;
}
} else if (partItr->_topology == model::Mesh::TRIANGLE_STRIP) {
} else if (partItr->_topology == graphics::Mesh::TRIANGLE_STRIP) {
// TODO: resurrect assert after we start sanitizing FBXMesh higher up
//assert(numIndices > 2);
@ -593,7 +593,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) {
// the rest use previous and next index
uint32_t triangleCount = 1;
while (indexItr != indexEnd) {
if ((*indexItr) != model::Mesh::PRIMITIVE_RESTART_INDEX) {
if ((*indexItr) != graphics::Mesh::PRIMITIVE_RESTART_INDEX) {
if (triangleCount % 2 == 0) {
// even triangles use first two indices in order
triangleIndices.push_back(*(indexItr - 2) + meshIndexOffset);
@ -613,12 +613,12 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) {
}
} else if (type == SHAPE_TYPE_SIMPLE_COMPOUND) {
// for each mesh copy unique part indices, separated by special bogus (flag) index values
gpu::BufferView::Iterator<const model::Mesh::Part> partItr = parts.cbegin<const model::Mesh::Part>();
while (partItr != parts.cend<const model::Mesh::Part>()) {
gpu::BufferView::Iterator<const graphics::Mesh::Part> partItr = parts.cbegin<const graphics::Mesh::Part>();
while (partItr != parts.cend<const graphics::Mesh::Part>()) {
// collect unique list of indices for this part
std::set<int32_t> uniqueIndices;
auto numIndices = partItr->_numIndices;
if (partItr->_topology == model::Mesh::TRIANGLES) {
if (partItr->_topology == graphics::Mesh::TRIANGLES) {
// TODO: assert rather than workaround after we start sanitizing FBXMesh higher up
//assert(numIndices% TRIANGLE_STRIDE == 0);
numIndices -= numIndices % TRIANGLE_STRIDE; // WORKAROUND lack of sanity checking in FBXReader
@ -629,7 +629,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) {
uniqueIndices.insert(*indexItr);
++indexItr;
}
} else if (partItr->_topology == model::Mesh::TRIANGLE_STRIP) {
} else if (partItr->_topology == graphics::Mesh::TRIANGLE_STRIP) {
// TODO: resurrect assert after we start sanitizing FBXMesh higher up
//assert(numIndices > TRIANGLE_STRIDE - 1);
@ -644,7 +644,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) {
// the rest use previous and next index
uint32_t triangleCount = 1;
while (indexItr != indexEnd) {
if ((*indexItr) != model::Mesh::PRIMITIVE_RESTART_INDEX) {
if ((*indexItr) != graphics::Mesh::PRIMITIVE_RESTART_INDEX) {
if (triangleCount % 2 == 0) {
// EVEN triangles use first two indices in order
uniqueIndices.insert(*(indexItr - 2));
@ -1295,7 +1295,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
ShapeType type = entity->getShapeType();
if (DependencyManager::get<EntityTreeRenderer>()->shouldRenderDebugHulls() && type != SHAPE_TYPE_STATIC_MESH && type != SHAPE_TYPE_NONE) {
// NOTE: it is OK if _collisionMeshKey is nullptr
model::MeshPointer mesh = collisionMeshCache.getMesh(_collisionMeshKey);
graphics::MeshPointer mesh = collisionMeshCache.getMesh(_collisionMeshKey);
// NOTE: the model will render the collisionGeometry if it has one
_model->setCollisionMesh(mesh);
} else {
@ -1304,7 +1304,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
collisionMeshCache.releaseMesh(_collisionMeshKey);
}
// clear model's collision geometry
model::MeshPointer mesh = nullptr;
graphics::MeshPointer mesh = nullptr;
_model->setCollisionMesh(mesh);
}
}

View file

@ -1060,7 +1060,7 @@ void RenderablePolyVoxEntityItem::recomputeMesh() {
auto entity = std::static_pointer_cast<RenderablePolyVoxEntityItem>(getThisPointer());
QtConcurrent::run([entity, voxelSurfaceStyle] {
model::MeshPointer mesh(new model::Mesh());
graphics::MeshPointer mesh(new graphics::Mesh());
// A mesh object to hold the result of surface extraction
PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal> polyVoxMesh;
@ -1122,18 +1122,18 @@ void RenderablePolyVoxEntityItem::recomputeMesh() {
sizeof(PolyVox::PositionMaterialNormal),
gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)));
std::vector<model::Mesh::Part> parts;
parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex
(model::Index)vecIndices.size(), // numIndices
(model::Index)0, // baseVertex
model::Mesh::TRIANGLES)); // topology
mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part),
std::vector<graphics::Mesh::Part> parts;
parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex
(graphics::Index)vecIndices.size(), // numIndices
(graphics::Index)0, // baseVertex
graphics::Mesh::TRIANGLES)); // topology
mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part),
(gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
entity->setMesh(mesh);
});
}
void RenderablePolyVoxEntityItem::setMesh(model::MeshPointer mesh) {
void RenderablePolyVoxEntityItem::setMesh(graphics::MeshPointer mesh) {
// this catches the payload from recomputeMesh
bool neighborsNeedUpdate;
withWriteLock([&] {
@ -1164,7 +1164,7 @@ void RenderablePolyVoxEntityItem::computeShapeInfoWorker() {
PolyVoxSurfaceStyle voxelSurfaceStyle;
glm::vec3 voxelVolumeSize;
model::MeshPointer mesh;
graphics::MeshPointer mesh;
withReadLock([&] {
voxelSurfaceStyle = _voxelSurfaceStyle;
@ -1582,7 +1582,7 @@ void PolyVoxEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& s
void PolyVoxEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
_lastVoxelToWorldMatrix = entity->voxelToWorldMatrix();
model::MeshPointer newMesh;
graphics::MeshPointer newMesh;
entity->withReadLock([&] {
newMesh = entity->_mesh;
});

View file

@ -104,7 +104,7 @@ public:
void forEachVoxelValue(const ivec3& voxelSize, std::function<void(const ivec3&, uint8_t)> thunk);
QByteArray volDataToArray(quint16 voxelXSize, quint16 voxelYSize, quint16 voxelZSize) const;
void setMesh(model::MeshPointer mesh);
void setMesh(graphics::MeshPointer mesh);
void setCollisionPoints(ShapeInfo::PointCollection points, AABox box);
PolyVox::SimpleVolume<uint8_t>* getVolData() { return _volData.get(); }
@ -134,7 +134,7 @@ private:
// may not match _voxelVolumeSize.
bool _meshDirty { true }; // does collision-shape need to be recomputed?
bool _meshReady{ false };
model::MeshPointer _mesh;
graphics::MeshPointer _mesh;
ShapeInfo _shapeInfo;
@ -178,7 +178,7 @@ private:
bool _hasTransitioned{ false };
#endif
model::MeshPointer _mesh;
graphics::MeshPointer _mesh;
std::array<NetworkTexturePointer, 3> _xyzTextures;
glm::vec3 _lastVoxelVolumeSize;
glm::mat4 _lastVoxelToWorldMatrix;

View file

@ -319,7 +319,7 @@ void ZoneEntityRenderer::updateKeySunFromEntity(const TypedEntityPointer& entity
setKeyLightMode((ComponentMode)entity->getKeyLightMode());
const auto& sunLight = editSunLight();
sunLight->setType(model::Light::SUN);
sunLight->setType(graphics::Light::SUN);
sunLight->setPosition(_lastPosition);
sunLight->setOrientation(_lastRotation);
@ -333,7 +333,7 @@ void ZoneEntityRenderer::updateAmbientLightFromEntity(const TypedEntityPointer&
setAmbientLightMode((ComponentMode)entity->getAmbientLightMode());
const auto& ambientLight = editAmbientLight();
ambientLight->setType(model::Light::AMBIENT);
ambientLight->setType(graphics::Light::AMBIENT);
ambientLight->setPosition(_lastPosition);
ambientLight->setOrientation(_lastRotation);
@ -357,23 +357,23 @@ void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity)
haze->setHazeActive(hazeMode == COMPONENT_MODE_ENABLED);
haze->setAltitudeBased(_hazeProperties.getHazeAltitudeEffect());
haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange()));
haze->setHazeRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange()));
xColor hazeColor = _hazeProperties.getHazeColor();
haze->setHazeColor(glm::vec3(hazeColor.red / 255.0, hazeColor.green / 255.0, hazeColor.blue / 255.0));
xColor hazeGlareColor = _hazeProperties.getHazeGlareColor();
haze->setHazeGlareColor(glm::vec3(hazeGlareColor.red / 255.0, hazeGlareColor.green / 255.0, hazeGlareColor.blue / 255.0));
haze->setHazeEnableGlare(_hazeProperties.getHazeEnableGlare());
haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle()));
haze->setHazeGlareBlend(graphics::Haze::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle()));
float hazeAltitude = _hazeProperties.getHazeCeiling() - _hazeProperties.getHazeBaseRef();
haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(hazeAltitude));
haze->setHazeAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(hazeAltitude));
haze->setHazeBaseReference(_hazeProperties.getHazeBaseRef());
haze->setHazeBackgroundBlend(_hazeProperties.getHazeBackgroundBlend());
haze->setHazeAttenuateKeyLight(_hazeProperties.getHazeAttenuateKeyLight());
haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeKeyLightRange()));
haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(_hazeProperties.getHazeKeyLightAltitude()));
haze->setHazeKeyLightRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeKeyLightRange()));
haze->setHazeKeyLightAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(_hazeProperties.getHazeKeyLightAltitude()));
haze->setZoneTransform(entity->getTransform().getMatrix());
}

View file

@ -63,11 +63,11 @@ private:
void setSkyboxColor(const glm::vec3& color);
void setProceduralUserData(const QString& userData);
model::LightPointer editSunLight() { _needSunUpdate = true; return _sunLight; }
model::LightPointer editAmbientLight() { _needAmbientUpdate = true; return _ambientLight; }
model::SunSkyStagePointer editBackground() { _needBackgroundUpdate = true; return _background; }
model::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); }
model::HazePointer editHaze() { _needHazeUpdate = true; return _haze; }
graphics::LightPointer editSunLight() { _needSunUpdate = true; return _sunLight; }
graphics::LightPointer editAmbientLight() { _needAmbientUpdate = true; return _ambientLight; }
graphics::SunSkyStagePointer editBackground() { _needBackgroundUpdate = true; return _background; }
graphics::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); }
graphics::HazePointer editHaze() { _needHazeUpdate = true; return _haze; }
bool _needsInitialSimulation{ true };
glm::vec3 _lastPosition;
@ -83,10 +83,10 @@ private:
#endif
LightStagePointer _stage;
const model::LightPointer _sunLight{ std::make_shared<model::Light>() };
const model::LightPointer _ambientLight{ std::make_shared<model::Light>() };
const model::SunSkyStagePointer _background{ std::make_shared<model::SunSkyStage>() };
const model::HazePointer _haze{ std::make_shared<model::Haze>() };
const graphics::LightPointer _sunLight{ std::make_shared<graphics::Light>() };
const graphics::LightPointer _ambientLight{ std::make_shared<graphics::Light>() };
const graphics::SunSkyStagePointer _background{ std::make_shared<graphics::SunSkyStage>() };
const graphics::HazePointer _haze{ std::make_shared<graphics::Haze>() };
ComponentMode _keyLightMode { COMPONENT_MODE_INHERIT };
ComponentMode _ambientLightMode { COMPONENT_MODE_INHERIT };

View file

@ -183,7 +183,7 @@ public:
QString materialID;
QString name;
QString shadingModel;
model::MaterialPointer _material;
graphics::MaterialPointer _material;
FBXTexture normalTexture;
FBXTexture albedoTexture;
@ -238,7 +238,7 @@ public:
unsigned int meshIndex; // the order the meshes appeared in the object file
model::MeshPointer _mesh;
graphics::MeshPointer _mesh;
bool wasCompressed { false };
};

View file

@ -72,7 +72,7 @@ Extents FBXGeometry::getUnscaledMeshExtents() const {
return scaledExtents;
}
// TODO: Move to model::Mesh when Sam's ready
// TODO: Move to graphics::Mesh when Sam's ready
bool FBXGeometry::convexHullContains(const glm::vec3& point) const {
if (!getUnscaledMeshExtents().containsPoint(point)) {
return false;

View file

@ -279,7 +279,7 @@ void FBXReader::consolidateFBXMaterials(const QVariantHash& mapping) {
}
// Finally create the true material representation
material._material = std::make_shared<model::Material>();
material._material = std::make_shared<graphics::Material>();
// Emissive color is the mix of emissiveColor with emissiveFactor
auto emissive = material.emissiveColor * (isMaterialLambert ? 1.0f : material.emissiveFactor); // In lambert there is not emissiveFactor
@ -293,7 +293,7 @@ void FBXReader::consolidateFBXMaterials(const QVariantHash& mapping) {
material._material->setRoughness(material.roughness);
material._material->setMetallic(material.metallic);
} else {
material._material->setRoughness(model::Material::shininessToRoughness(material.shininess));
material._material->setRoughness(graphics::Material::shininessToRoughness(material.shininess));
float metallic = std::max(material.specularColor.x, std::max(material.specularColor.y, material.specularColor.z));
material._material->setMetallic(metallic);

View file

@ -584,7 +584,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
}
FBXMesh& fbxMesh = extractedMesh;
model::MeshPointer mesh(new model::Mesh());
graphics::MeshPointer mesh(new graphics::Mesh());
// Grab the vertices in a buffer
auto vb = std::make_shared<gpu::Buffer>();
@ -721,45 +721,45 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
if (normalsSize) {
mesh->addAttribute(gpu::Stream::NORMAL,
model::BufferView(attribBuffer, normalsOffset, normalsAndTangentsSize,
graphics::BufferView(attribBuffer, normalsOffset, normalsAndTangentsSize,
normalsAndTangentsStride, FBX_NORMAL_ELEMENT));
mesh->addAttribute(gpu::Stream::TANGENT,
model::BufferView(attribBuffer, tangentsOffset, normalsAndTangentsSize,
graphics::BufferView(attribBuffer, tangentsOffset, normalsAndTangentsSize,
normalsAndTangentsStride, FBX_NORMAL_ELEMENT));
}
if (colorsSize) {
mesh->addAttribute(gpu::Stream::COLOR,
model::BufferView(attribBuffer, colorsOffset, colorsSize, FBX_COLOR_ELEMENT));
graphics::BufferView(attribBuffer, colorsOffset, colorsSize, FBX_COLOR_ELEMENT));
}
if (texCoordsSize) {
mesh->addAttribute(gpu::Stream::TEXCOORD,
model::BufferView( attribBuffer, texCoordsOffset, texCoordsSize,
graphics::BufferView( attribBuffer, texCoordsOffset, texCoordsSize,
gpu::Element(gpu::VEC2, gpu::HALF, gpu::UV)));
}
if (texCoords1Size) {
mesh->addAttribute( gpu::Stream::TEXCOORD1,
model::BufferView(attribBuffer, texCoords1Offset, texCoords1Size,
graphics::BufferView(attribBuffer, texCoords1Offset, texCoords1Size,
gpu::Element(gpu::VEC2, gpu::HALF, gpu::UV)));
} else if (texCoordsSize) {
mesh->addAttribute(gpu::Stream::TEXCOORD1,
model::BufferView(attribBuffer, texCoordsOffset, texCoordsSize,
graphics::BufferView(attribBuffer, texCoordsOffset, texCoordsSize,
gpu::Element(gpu::VEC2, gpu::HALF, gpu::UV)));
}
if (clusterIndicesSize) {
if (fbxMesh.clusters.size() < UINT8_MAX) {
mesh->addAttribute(gpu::Stream::SKIN_CLUSTER_INDEX,
model::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize,
graphics::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize,
gpu::Element(gpu::VEC4, gpu::UINT8, gpu::XYZW)));
} else {
mesh->addAttribute(gpu::Stream::SKIN_CLUSTER_INDEX,
model::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize,
graphics::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize,
gpu::Element(gpu::VEC4, gpu::UINT16, gpu::XYZW)));
}
}
if (clusterWeightsSize) {
mesh->addAttribute(gpu::Stream::SKIN_CLUSTER_WEIGHT,
model::BufferView(attribBuffer, clusterWeightsOffset, clusterWeightsSize,
graphics::BufferView(attribBuffer, clusterWeightsOffset, clusterWeightsSize,
gpu::Element(gpu::VEC4, gpu::NUINT16, gpu::XYZW)));
}
@ -780,12 +780,12 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
int indexNum = 0;
int offset = 0;
std::vector< model::Mesh::Part > parts;
std::vector< graphics::Mesh::Part > parts;
if (extractedMesh.parts.size() > 1) {
indexNum = 0;
}
foreach(const FBXMeshPart& part, extractedMesh.parts) {
model::Mesh::Part modelPart(indexNum, 0, 0, model::Mesh::TRIANGLES);
graphics::Mesh::Part modelPart(indexNum, 0, 0, graphics::Mesh::TRIANGLES);
if (part.quadTrianglesIndices.size()) {
indexBuffer->setSubData(offset,
@ -813,7 +813,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
if (parts.size()) {
auto pb = std::make_shared<gpu::Buffer>();
pb->setData(parts.size() * sizeof(model::Mesh::Part), (const gpu::Byte*) parts.data());
pb->setData(parts.size() * sizeof(graphics::Mesh::Part), (const gpu::Byte*) parts.data());
gpu::BufferView pbv(pb, gpu::Element(gpu::VEC4, gpu::UINT32, gpu::XYZW));
mesh->setPartBuffer(pbv);
} else {
@ -821,7 +821,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
return;
}
// model::Box box =
// graphics::Box box =
mesh->evalPartBound(0);
extractedMesh._mesh = mesh;

View file

@ -748,7 +748,7 @@ bool GLTFReader::buildGeometry(FBXGeometry& geometry, const QUrl& url) {
QString& matid = materialIDs[i];
geometry.materials[matid] = FBXMaterial();
FBXMaterial& fbxMaterial = geometry.materials[matid];
fbxMaterial._material = std::make_shared<model::Material>();
fbxMaterial._material = std::make_shared<graphics::Material>();
setFBXMaterial(fbxMaterial, _file.materials[i]);
}

View file

@ -750,8 +750,8 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
objMaterial.opacity);
FBXMaterial& fbxMaterial = geometry.materials[materialID];
fbxMaterial.materialID = materialID;
fbxMaterial._material = std::make_shared<model::Material>();
model::MaterialPointer modelMaterial = fbxMaterial._material;
fbxMaterial._material = std::make_shared<graphics::Material>();
graphics::MaterialPointer modelMaterial = fbxMaterial._material;
if (!objMaterial.diffuseTextureFilename.isEmpty()) {
fbxMaterial.albedoTexture.filename = objMaterial.diffuseTextureFilename;
@ -763,7 +763,7 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
modelMaterial->setEmissive(fbxMaterial.emissiveColor);
modelMaterial->setAlbedo(fbxMaterial.diffuseColor);
modelMaterial->setMetallic(glm::length(fbxMaterial.specularColor));
modelMaterial->setRoughness(model::Material::shininessToRoughness(fbxMaterial.shininess));
modelMaterial->setRoughness(graphics::Material::shininessToRoughness(fbxMaterial.shininess));
if (fbxMaterial.opacity <= 0.0f) {
modelMaterial->setOpacity(1.0f);

View file

@ -105,13 +105,13 @@ bool writeOBJToTextStream(QTextStream& out, QList<MeshPointer> meshes) {
const gpu::BufferView& partBuffer = mesh->getPartBuffer();
const gpu::BufferView& indexBuffer = mesh->getIndexBuffer();
model::Index partCount = (model::Index)mesh->getNumParts();
graphics::Index partCount = (graphics::Index)mesh->getNumParts();
for (int partIndex = 0; partIndex < partCount; partIndex++) {
const model::Mesh::Part& part = partBuffer.get<model::Mesh::Part>(partIndex);
const graphics::Mesh::Part& part = partBuffer.get<graphics::Mesh::Part>(partIndex);
out << "g part-" << nth++ << "\n";
// model::Mesh::TRIANGLES
// graphics::Mesh::TRIANGLES
// TODO -- handle other formats
gpu::BufferView::Iterator<const uint32_t> indexItr = indexBuffer.cbegin<uint32_t>();
indexItr += part._startIndex;

View file

@ -17,7 +17,7 @@
#include <QList>
#include <graphics/Geometry.h>
using MeshPointer = std::shared_ptr<model::Mesh>;
using MeshPointer = std::shared_ptr<graphics::Mesh>;
bool writeOBJToTextStream(QTextStream& out, QList<MeshPointer> meshes);
bool writeOBJToFile(QString path, QList<MeshPointer> meshes);

View file

@ -10,7 +10,7 @@
//
#include "Asset.h"
using namespace model;
using namespace graphics;
Asset::Asset() {
}

View file

@ -17,7 +17,7 @@
#include "Material.h"
#include "Geometry.h"
namespace model {
namespace graphics {
template <class T>
class Table {

View file

@ -11,7 +11,7 @@
#ifndef hifi_model_Forward_h
#define hifi_model_Forward_h
namespace model {
namespace graphics {
class Mesh;
using MeshPointer = std::shared_ptr<Mesh>;
}

View file

@ -13,7 +13,7 @@
#include <glm/gtc/packing.hpp>
using namespace model;
using namespace graphics;
Mesh::Mesh() :
_vertexBuffer(gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)),
@ -137,7 +137,7 @@ Box Mesh::evalPartsBound(int partStart, int partEnd) const {
}
model::MeshPointer Mesh::map(std::function<glm::vec3(glm::vec3)> vertexFunc,
graphics::MeshPointer Mesh::map(std::function<glm::vec3(glm::vec3)> vertexFunc,
std::function<glm::vec3(glm::vec3)> colorFunc,
std::function<glm::vec3(glm::vec3)> normalFunc,
std::function<uint32_t(uint32_t)> indexFunc) const {
@ -223,7 +223,7 @@ model::MeshPointer Mesh::map(std::function<glm::vec3(glm::vec3)> vertexFunc,
indexDataCursor += sizeof(index);
}
model::MeshPointer result(new model::Mesh());
graphics::MeshPointer result(new graphics::Mesh());
gpu::Element vertexElement = gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ);
gpu::Buffer* resultVertexBuffer = new gpu::Buffer(vertexSize, resultVertexData.get());
@ -252,12 +252,12 @@ model::MeshPointer Mesh::map(std::function<glm::vec3(glm::vec3)> vertexFunc,
// TODO -- shouldn't assume just one part
std::vector<model::Mesh::Part> parts;
parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex
(model::Index)result->getNumIndices(), // numIndices
(model::Index)0, // baseVertex
model::Mesh::TRIANGLES)); // topology
result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part),
std::vector<graphics::Mesh::Part> parts;
parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex
(graphics::Index)result->getNumIndices(), // numIndices
(graphics::Index)0, // baseVertex
graphics::Mesh::TRIANGLES)); // topology
result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part),
(gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
return result;
@ -350,9 +350,9 @@ MeshPointer Mesh::createIndexedTriangles_P3F(uint32_t numVertices, uint32_t numI
}
std::vector<model::Mesh::Part> parts;
parts.push_back(model::Mesh::Part(0, numIndices, 0, model::Mesh::TRIANGLES));
mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
std::vector<graphics::Mesh::Part> parts;
parts.push_back(graphics::Mesh::Part(0, numIndices, 0, graphics::Mesh::TRIANGLES));
mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
return mesh;
}

View file

@ -18,7 +18,7 @@
#include <gpu/Resource.h>
#include <gpu/Stream.h>
namespace model {
namespace graphics {
typedef gpu::BufferView::Index Index;
typedef gpu::BufferView BufferView;
typedef AABox Box;
@ -40,7 +40,7 @@ public:
typedef gpu::Stream::Format VertexFormat;
typedef std::map< Slot, BufferView > BufferViewMap;
typedef model::Vec3 Vec3;
typedef graphics::Vec3 Vec3;
Mesh();
Mesh(const Mesh& mesh);

View file

@ -12,7 +12,7 @@
#include <memory>
#include "Haze.h"
using namespace model;
using namespace graphics;
const float Haze::INITIAL_HAZE_RANGE{ 1000.0f };
const float Haze::INITIAL_HAZE_HEIGHT{ 200.0f };

View file

@ -17,7 +17,7 @@
#include "Transform.h"
#include "NumericalConstants.h"
namespace model {
namespace graphics {
// Haze range is defined here as the range the visibility is reduced by 95%
// Haze altitude is defined here as the altitude (above 0) that the haze is reduced by 95%

View file

@ -10,7 +10,7 @@
//
#include "Light.h"
using namespace model;
using namespace graphics;
Light::Light() {
updateLightRadius();

View file

@ -19,7 +19,7 @@
#include "gpu/Resource.h"
#include "gpu/Texture.h"
namespace model {
namespace graphics {
typedef gpu::BufferView UniformBufferView;
typedef gpu::TextureView TextureView;
typedef glm::vec3 Vec3;

View file

@ -12,7 +12,7 @@
#include "TextureMap.h"
using namespace model;
using namespace graphics;
using namespace gpu;
Material::Material() :

View file

@ -20,7 +20,7 @@
#include <gpu/Resource.h>
namespace model {
namespace graphics {
class TextureMap;
typedef std::shared_ptr< TextureMap > TextureMapPointer;

View file

@ -18,7 +18,7 @@
#include "skybox_vert.h"
#include "skybox_frag.h"
using namespace model;
using namespace graphics;
Skybox::Skybox() {
Schema schema;

View file

@ -19,7 +19,7 @@ class ViewFrustum;
namespace gpu { class Batch; }
namespace model {
namespace graphics {
typedef glm::vec3 Color;

View file

@ -15,7 +15,7 @@
#include <qcompilerdetection.h>
#include <ComponentMode.h>
using namespace model;
using namespace graphics;
void EarthSunModel::updateAll() const {

View file

@ -16,7 +16,7 @@
#include "Light.h"
#include "Skybox.h"
namespace model {
namespace graphics {
typedef glm::dvec3 Vec3d;
typedef glm::dvec4 Vec4d;

View file

@ -10,7 +10,7 @@
//
#include "TextureMap.h"
using namespace model;
using namespace graphics;
using namespace gpu;
void TextureMap::setTextureSource(TextureSourcePointer& textureSource) {

View file

@ -15,7 +15,7 @@
#include "Transform.h"
namespace model {
namespace graphics {
class TextureMap {
public:

View file

@ -516,13 +516,13 @@ QUrl NetworkMaterial::getTextureUrl(const QUrl& baseUrl, const FBXTexture& textu
}
}
model::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture,
graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture,
image::TextureUsage::Type type, MapChannel channel) {
const auto url = getTextureUrl(baseUrl, fbxTexture);
const auto texture = DependencyManager::get<TextureCache>()->getTexture(url, type, fbxTexture.content, fbxTexture.maxNumPixels);
_textures[channel] = Texture { fbxTexture.name, texture };
auto map = std::make_shared<model::TextureMap>();
auto map = std::make_shared<graphics::TextureMap>();
if (texture) {
map->setTextureSource(texture->_textureSource);
}
@ -531,18 +531,18 @@ model::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, c
return map;
}
model::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel) {
graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel) {
const auto texture = DependencyManager::get<TextureCache>()->getTexture(url, type);
_textures[channel].texture = texture;
auto map = std::make_shared<model::TextureMap>();
auto map = std::make_shared<graphics::TextureMap>();
map->setTextureSource(texture->_textureSource);
return map;
}
NetworkMaterial::NetworkMaterial(const FBXMaterial& material, const QUrl& textureBaseUrl) :
model::Material(*material._material)
graphics::Material(*material._material)
{
_textures = Textures(MapChannel::NUM_MAP_CHANNELS);
if (!material.albedoTexture.filename.isEmpty()) {

View file

@ -38,7 +38,7 @@ public:
Geometry(const Geometry& geometry);
// Immutable over lifetime
using GeometryMeshes = std::vector<std::shared_ptr<const model::Mesh>>;
using GeometryMeshes = std::vector<std::shared_ptr<const graphics::Mesh>>;
using GeometryMeshParts = std::vector<std::shared_ptr<const MeshPart>>;
// Mutable, but must retain structure of vector
@ -157,9 +157,9 @@ private:
virtual ~ModelCache() = default;
};
class NetworkMaterial : public model::Material {
class NetworkMaterial : public graphics::Material {
public:
using MapChannel = model::Material::MapChannel;
using MapChannel = graphics::Material::MapChannel;
NetworkMaterial(const FBXMaterial& material, const QUrl& textureBaseUrl);
@ -185,9 +185,9 @@ protected:
private:
// Helpers for the ctors
QUrl getTextureUrl(const QUrl& baseUrl, const FBXTexture& fbxTexture);
model::TextureMapPointer fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture,
graphics::TextureMapPointer fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture,
image::TextureUsage::Type type, MapChannel channel);
model::TextureMapPointer fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel);
graphics::TextureMapPointer fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel);
Transform _albedoTransform;
Transform _lightmapTransform;

View file

@ -21,7 +21,7 @@
const int32_t MAX_HULL_INDICES = 6 * MAX_HULL_POINTS;
const int32_t MAX_HULL_NORMALS = MAX_HULL_INDICES;
float tempVertices[MAX_HULL_NORMALS];
model::Index tempIndexBuffer[MAX_HULL_INDICES];
graphics::Index tempIndexBuffer[MAX_HULL_INDICES];
bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape,
gpu::BufferView& vertices, gpu::BufferView& indices, gpu::BufferView& parts,
@ -40,21 +40,21 @@ bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape,
assert(numHullVertices <= MAX_HULL_POINTS);
{ // new part
model::Mesh::Part part;
part._startIndex = (model::Index)indices.getNumElements();
part._numIndices = (model::Index)numHullIndices;
graphics::Mesh::Part part;
part._startIndex = (graphics::Index)indices.getNumElements();
part._numIndices = (graphics::Index)numHullIndices;
// FIXME: the render code cannot handle the case where part._baseVertex != 0
//part._baseVertex = vertices.getNumElements(); // DOES NOT WORK
part._baseVertex = 0;
gpu::BufferView::Size numBytes = sizeof(model::Mesh::Part);
gpu::BufferView::Size numBytes = sizeof(graphics::Mesh::Part);
const gpu::Byte* data = reinterpret_cast<const gpu::Byte*>(&part);
parts._buffer->append(numBytes, data);
parts._size = parts._buffer->getSize();
}
const int32_t SIZE_OF_VEC3 = 3 * sizeof(float);
model::Index indexOffset = (model::Index)vertices.getNumElements();
graphics::Index indexOffset = (graphics::Index)vertices.getNumElements();
{ // new indices
const uint32_t* hullIndices = hull.getIndexPointer();
@ -64,7 +64,7 @@ bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape,
tempIndexBuffer[i] = hullIndices[i] + indexOffset;
}
const gpu::Byte* data = reinterpret_cast<const gpu::Byte*>(tempIndexBuffer);
gpu::BufferView::Size numBytes = (gpu::BufferView::Size)(sizeof(model::Index) * numHullIndices);
gpu::BufferView::Size numBytes = (gpu::BufferView::Size)(sizeof(graphics::Index) * numHullIndices);
indices._buffer->append(numBytes, data);
indices._size = indices._buffer->getSize();
}
@ -105,8 +105,8 @@ bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape,
return true;
}
model::MeshPointer createMeshFromShape(const void* pointer) {
model::MeshPointer mesh;
graphics::MeshPointer createMeshFromShape(const void* pointer) {
graphics::MeshPointer mesh;
if (!pointer) {
return mesh;
}
@ -147,7 +147,7 @@ model::MeshPointer createMeshFromShape(const void* pointer) {
}
}
if (numSuccesses > 0) {
mesh = std::make_shared<model::Mesh>();
mesh = std::make_shared<graphics::Mesh>();
mesh->setVertexBuffer(vertices);
mesh->setIndexBuffer(indices);
mesh->setPartBuffer(parts);
@ -167,8 +167,8 @@ CollisionRenderMeshCache::~CollisionRenderMeshCache() {
_pendingGarbage.clear();
}
model::MeshPointer CollisionRenderMeshCache::getMesh(CollisionRenderMeshCache::Key key) {
model::MeshPointer mesh;
graphics::MeshPointer CollisionRenderMeshCache::getMesh(CollisionRenderMeshCache::Key key) {
graphics::MeshPointer mesh;
if (key) {
CollisionMeshMap::const_iterator itr = _meshMap.find(key);
if (itr == _meshMap.end()) {

View file

@ -27,7 +27,7 @@ public:
~CollisionRenderMeshCache();
/// \return pointer to geometry
model::MeshPointer getMesh(Key key);
graphics::MeshPointer getMesh(Key key);
/// \return true if geometry was found and released
bool releaseMesh(Key key);
@ -40,7 +40,7 @@ public:
bool hasMesh(Key key) const { return _meshMap.find(key) == _meshMap.end(); }
private:
using CollisionMeshMap = std::unordered_map<Key, model::MeshPointer>;
using CollisionMeshMap = std::unordered_map<Key, graphics::MeshPointer>;
CollisionMeshMap _meshMap;
std::vector<Key> _pendingGarbage;
};

View file

@ -18,7 +18,7 @@
#include <graphics/skybox_vert.h>
#include <graphics/skybox_frag.h>
ProceduralSkybox::ProceduralSkybox() : model::Skybox() {
ProceduralSkybox::ProceduralSkybox() : graphics::Skybox() {
_procedural._vertexSource = skybox_vert;
_procedural._fragmentSource = skybox_frag;
// Adjust the pipeline state for background using the stencil test

View file

@ -17,7 +17,7 @@
#include "Procedural.h"
class ProceduralSkybox: public model::Skybox {
class ProceduralSkybox: public graphics::Skybox {
public:
ProceduralSkybox();

View file

@ -64,8 +64,8 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>();
assert(backgroundStage);
model::SunSkyStagePointer background;
model::SkyboxPointer skybox;
graphics::SunSkyStagePointer background;
graphics::SkyboxPointer skybox;
if (backgroundStage->_currentFrame._backgrounds.size()) {
auto backgroundId = backgroundStage->_currentFrame._backgrounds.front();
auto background = backgroundStage->getBackground(backgroundId);
@ -76,7 +76,7 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
/* auto backgroundMode = skyStage->getBackgroundMode();
switch (backgroundMode) {
case model::SunSkyStage::SKY_DEFAULT: {
case graphics::SunSkyStage::SKY_DEFAULT: {
auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage();
auto sceneKeyLight = scene->getKeyLight();
@ -88,7 +88,7 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
// fall through: render a skybox (if available), or the defaults (if requested)
}
case model::SunSkyStage::SKY_BOX: {*/
case graphics::SunSkyStage::SKY_BOX: {*/
if (skybox && !skybox->empty()) {
PerformanceTimer perfTimer("skybox");
auto args = renderContext->args;
@ -118,7 +118,7 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
// fall through: render defaults (if requested)
// }
/*
case model::SunSkyStage::SKY_DEFAULT_AMBIENT_TEXTURE: {
case graphics::SunSkyStage::SKY_DEFAULT_AMBIENT_TEXTURE: {
if (Menu::getInstance()->isOptionChecked(MenuOption::DefaultSkybox)) {
auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage();
auto sceneKeyLight = scene->getKeyLight();

View file

@ -30,8 +30,8 @@ public:
static const Index INVALID_INDEX;
static bool isIndexInvalid(Index index) { return index == INVALID_INDEX; }
using BackgroundPointer = model::SunSkyStagePointer;
using Backgrounds = render::indexed_container::IndexedPointerVector<model::SunSkyStage>;
using BackgroundPointer = graphics::SunSkyStagePointer;
using Backgrounds = render::indexed_container::IndexedPointerVector<graphics::SunSkyStage>;
using BackgroundMap = std::unordered_map<BackgroundPointer, Index>;
using BackgroundIndices = std::vector<Index>;

View file

@ -103,13 +103,13 @@ void DeferredLightingEffect::init() {
void DeferredLightingEffect::setupKeyLightBatch(const RenderArgs* args, gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) {
PerformanceTimer perfTimer("DLE->setupBatch()");
model::LightPointer keySunLight;
graphics::LightPointer keySunLight;
auto lightStage = args->_scene->getStage<LightStage>();
if (lightStage) {
keySunLight = lightStage->getCurrentKeyLight();
}
model::LightPointer keyAmbiLight;
graphics::LightPointer keyAmbiLight;
if (lightStage) {
keyAmbiLight = lightStage->getCurrentAmbientLight();
}
@ -229,9 +229,9 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo
#include <shared/Shapes.h>
model::MeshPointer DeferredLightingEffect::getPointLightMesh() {
graphics::MeshPointer DeferredLightingEffect::getPointLightMesh() {
if (!_pointLightMesh) {
_pointLightMesh = std::make_shared<model::Mesh>();
_pointLightMesh = std::make_shared<graphics::Mesh>();
// let's use a icosahedron
auto solid = geometry::icosahedron();
@ -256,19 +256,19 @@ model::MeshPointer DeferredLightingEffect::getPointLightMesh() {
delete[] indexData;
std::vector<model::Mesh::Part> parts;
parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::TRIANGLES));
parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::LINE_STRIP)); // outline version
std::vector<graphics::Mesh::Part> parts;
parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::TRIANGLES));
parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::LINE_STRIP)); // outline version
_pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
_pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
}
return _pointLightMesh;
}
model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
graphics::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
if (!_spotLightMesh) {
_spotLightMesh = std::make_shared<model::Mesh>();
_spotLightMesh = std::make_shared<graphics::Mesh>();
int slices = 16;
int rings = 3;
@ -353,12 +353,12 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
delete[] indexData;
std::vector<model::Mesh::Part> parts;
parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::TRIANGLES));
parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::LINE_STRIP)); // outline version
std::vector<graphics::Mesh::Part> parts;
parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::TRIANGLES));
parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::LINE_STRIP)); // outline version
_spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
_spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
}
return _spotLightMesh;
}
@ -439,7 +439,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
const DeferredFrameTransformPointer& frameTransform,
const DeferredFramebufferPointer& deferredFramebuffer,
const LightingModelPointer& lightingModel,
const model::HazePointer& haze,
const graphics::HazePointer& haze,
const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer,
const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer,
const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource) {
@ -513,7 +513,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
auto keyLight = lightAndShadow.first;
model::LightPointer keyAmbientLight;
graphics::LightPointer keyAmbientLight;
if (lightStage && lightStage->_currentFrame._ambientLights.size()) {
keyAmbientLight = lightStage->getLight(lightStage->_currentFrame._ambientLights.front());
}
@ -744,12 +744,12 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) {
if (lightStage) {
// Allocate a default global light directional and ambient
auto lp = std::make_shared<model::Light>();
lp->setType(model::Light::SUN);
auto lp = std::make_shared<graphics::Light>();
lp->setType(graphics::Light::SUN);
lp->setDirection(glm::vec3(-1.0f));
lp->setColor(glm::vec3(1.0f));
lp->setIntensity(1.0f);
lp->setType(model::Light::SUN);
lp->setType(graphics::Light::SUN);
lp->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE);
lp->setAmbientIntensity(0.5f);
@ -771,7 +771,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) {
auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>();
if (backgroundStage) {
auto background = std::make_shared<model::SunSkyStage>();
auto background = std::make_shared<graphics::SunSkyStage>();
background->setSkybox(_defaultSkybox);
// capture deault background
@ -786,7 +786,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) {
auto hazeStage = renderContext->_scene->getStage<HazeStage>();
if (hazeStage) {
auto haze = std::make_shared<model::Haze>();
auto haze = std::make_shared<graphics::Haze>();
_defaultHaze = haze;
_defaultHazeID = hazeStage->addHaze(_defaultHaze);

View file

@ -61,10 +61,10 @@ private:
bool _shadowMapEnabled{ false };
bool _ambientOcclusionEnabled{ false };
model::MeshPointer _pointLightMesh;
model::MeshPointer getPointLightMesh();
model::MeshPointer _spotLightMesh;
model::MeshPointer getSpotLightMesh();
graphics::MeshPointer _pointLightMesh;
graphics::MeshPointer getPointLightMesh();
graphics::MeshPointer _spotLightMesh;
graphics::MeshPointer getSpotLightMesh();
gpu::PipelinePointer _directionalSkyboxLight;
gpu::PipelinePointer _directionalAmbientSphereLight;
@ -121,7 +121,7 @@ public:
const DeferredFrameTransformPointer& frameTransform,
const DeferredFramebufferPointer& deferredFramebuffer,
const LightingModelPointer& lightingModel,
const model::HazePointer& haze,
const graphics::HazePointer& haze,
const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer,
const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer,
const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource);
@ -158,7 +158,7 @@ class RenderDeferred {
public:
using Inputs = render::VaryingSet8 <
DeferredFrameTransformPointer, DeferredFramebufferPointer, LightingModelPointer, SurfaceGeometryFramebufferPointer,
AmbientOcclusionFramebufferPointer, SubsurfaceScatteringResourcePointer, LightClustersPointer, model::HazePointer>;
AmbientOcclusionFramebufferPointer, SubsurfaceScatteringResourcePointer, LightClustersPointer, graphics::HazePointer>;
using Config = RenderDeferredConfig;
using JobModel = render::Job::ModelI<RenderDeferred, Inputs, Config>;
@ -184,13 +184,13 @@ public:
void run(const render::RenderContextPointer& renderContext);
protected:
model::LightPointer _defaultLight;
graphics::LightPointer _defaultLight;
LightStage::Index _defaultLightID{ LightStage::INVALID_INDEX };
model::SunSkyStagePointer _defaultBackground;
graphics::SunSkyStagePointer _defaultBackground;
BackgroundStage::Index _defaultBackgroundID{ BackgroundStage::INVALID_INDEX };
model::HazePointer _defaultHaze{ nullptr };
graphics::HazePointer _defaultHaze{ nullptr };
HazeStage::Index _defaultHazeID{ HazeStage::INVALID_INDEX };
model::SkyboxPointer _defaultSkybox { new ProceduralSkybox() };
graphics::SkyboxPointer _defaultSkybox { new ProceduralSkybox() };
gpu::TexturePointer _defaultSkyboxTexture;
gpu::TexturePointer _defaultSkyboxAmbientTexture;
};

View file

@ -78,12 +78,12 @@ void HazeConfig::setHazeBackgroundBlend(const float value) {
}
MakeHaze::MakeHaze() {
_haze = std::make_shared<model::Haze>();
_haze = std::make_shared<graphics::Haze>();
}
void MakeHaze::configure(const Config& config) {
_haze->setHazeColor(config.hazeColor);
_haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(config.hazeGlareAngle));
_haze->setHazeGlareBlend(graphics::Haze::convertGlareAngleToPower(config.hazeGlareAngle));
_haze->setHazeGlareColor(config.hazeGlareColor);
_haze->setHazeBaseReference(config.hazeBaseReference);
@ -94,16 +94,16 @@ void MakeHaze::configure(const Config& config) {
_haze->setModulateColorActive(config.isModulateColorActive);
_haze->setHazeEnableGlare(config.isHazeEnableGlare);
_haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange));
_haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight));
_haze->setHazeRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange));
_haze->setHazeAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight));
_haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange));
_haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude));
_haze->setHazeKeyLightRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange));
_haze->setHazeKeyLightAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude));
_haze->setHazeBackgroundBlend(config.hazeBackgroundBlend);
}
void MakeHaze::run(const render::RenderContextPointer& renderContext, model::HazePointer& haze) {
void MakeHaze::run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze) {
haze = _haze;
}
@ -168,7 +168,7 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu
auto hazeStage = args->_scene->getStage<HazeStage>();
if (hazeStage && hazeStage->_currentFrame._hazes.size() > 0) {
model::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front());
graphics::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front());
if (hazePointer) {
batch.setUniformBuffer(HazeEffect_ParamsSlot, hazePointer->getHazeParametersBuffer());
} else {
@ -181,7 +181,7 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu
auto lightStage = args->_scene->getStage<LightStage>();
if (lightStage) {
model::LightPointer keyLight;
graphics::LightPointer keyLight;
keyLight = lightStage->getCurrentKeyLight();
if (keyLight) {
batch.setUniformBuffer(HazeEffect_LightingMapSlot, keyLight->getLightSchemaBuffer());

View file

@ -51,11 +51,11 @@ class MakeHazeConfig : public render::Job::Config {
public:
MakeHazeConfig() : render::Job::Config() {}
glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR };
float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE };
glm::vec3 hazeColor{ graphics::Haze::INITIAL_HAZE_COLOR };
float hazeGlareAngle{ graphics::Haze::INITIAL_HAZE_GLARE_ANGLE };
glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR };
float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE };
glm::vec3 hazeGlareColor{ graphics::Haze::INITIAL_HAZE_GLARE_COLOR };
float hazeBaseReference{ graphics::Haze::INITIAL_HAZE_BASE_REFERENCE };
bool isHazeActive{ false };
bool isAltitudeBased{ false };
@ -63,13 +63,13 @@ public:
bool isModulateColorActive{ false };
bool isHazeEnableGlare{ false };
float hazeRange{ model::Haze::INITIAL_HAZE_RANGE };
float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT };
float hazeRange{ graphics::Haze::INITIAL_HAZE_RANGE };
float hazeHeight{ graphics::Haze::INITIAL_HAZE_HEIGHT };
float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE };
float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE };
float hazeKeyLightRange{ graphics::Haze::INITIAL_KEY_LIGHT_RANGE };
float hazeKeyLightAltitude{ graphics::Haze::INITIAL_KEY_LIGHT_ALTITUDE };
float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND };
float hazeBackgroundBlend{ graphics::Haze::INITIAL_HAZE_BACKGROUND_BLEND };
public slots:
void setHazeColor(const glm::vec3 value) { hazeColor = value; emit dirty(); }
@ -99,15 +99,15 @@ signals:
class MakeHaze {
public:
using Config = MakeHazeConfig;
using JobModel = render::Job::ModelO<MakeHaze, model::HazePointer, Config>;
using JobModel = render::Job::ModelO<MakeHaze, graphics::HazePointer, Config>;
MakeHaze();
void configure(const Config& config);
void run(const render::RenderContextPointer& renderContext, model::HazePointer& haze);
void run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze);
private:
model::HazePointer _haze;
graphics::HazePointer _haze;
};
class HazeConfig : public render::Job::Config {
@ -115,11 +115,11 @@ public:
HazeConfig() : render::Job::Config(true) {}
// attributes
glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR };
float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE };
glm::vec3 hazeColor{ graphics::Haze::INITIAL_HAZE_COLOR };
float hazeGlareAngle{ graphics::Haze::INITIAL_HAZE_GLARE_ANGLE };
glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR };
float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE };
glm::vec3 hazeGlareColor{ graphics::Haze::INITIAL_HAZE_GLARE_COLOR };
float hazeBaseReference{ graphics::Haze::INITIAL_HAZE_BASE_REFERENCE };
bool isHazeActive{ false }; // Setting this to true will set haze to on
bool isAltitudeBased{ false };
@ -127,13 +127,13 @@ public:
bool isModulateColorActive{ false };
bool isHazeEnableGlare{ false };
float hazeRange{ model::Haze::INITIAL_HAZE_RANGE };
float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT };
float hazeRange{ graphics::Haze::INITIAL_HAZE_RANGE };
float hazeHeight{ graphics::Haze::INITIAL_HAZE_HEIGHT };
float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE };
float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE };
float hazeKeyLightRange{ graphics::Haze::INITIAL_KEY_LIGHT_RANGE };
float hazeKeyLightAltitude{ graphics::Haze::INITIAL_KEY_LIGHT_ALTITUDE };
float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND };
float hazeBackgroundBlend{ graphics::Haze::INITIAL_HAZE_BACKGROUND_BLEND };
// methods
void setHazeColor(const glm::vec3 value);
@ -159,7 +159,7 @@ public:
class DrawHaze {
public:
using Inputs = render::VaryingSet5<model::HazePointer, gpu::FramebufferPointer, LinearDepthFramebufferPointer, DeferredFrameTransformPointer, gpu::FramebufferPointer>;
using Inputs = render::VaryingSet5<graphics::HazePointer, gpu::FramebufferPointer, LinearDepthFramebufferPointer, DeferredFrameTransformPointer, gpu::FramebufferPointer>;
using Config = HazeConfig;
using JobModel = render::Job::ModelI<DrawHaze, Inputs, Config>;

View file

@ -17,12 +17,12 @@ std::string HazeStage::_stageName { "HAZE_STAGE"};
const HazeStage::Index HazeStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX };
FetchHazeStage::FetchHazeStage() {
_haze = std::make_shared<model::Haze>();
_haze = std::make_shared<graphics::Haze>();
}
void FetchHazeStage::configure(const Config& config) {
_haze->setHazeColor(config.hazeColor);
_haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(config.hazeGlareAngle));
_haze->setHazeGlareBlend(graphics::Haze::convertGlareAngleToPower(config.hazeGlareAngle));
_haze->setHazeGlareColor(config.hazeGlareColor);
_haze->setHazeBaseReference(config.hazeBaseReference);
@ -33,11 +33,11 @@ void FetchHazeStage::configure(const Config& config) {
_haze->setModulateColorActive(config.isModulateColorActive);
_haze->setHazeEnableGlare(config.isHazeEnableGlare);
_haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange));
_haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight));
_haze->setHazeRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange));
_haze->setHazeAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight));
_haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange));
_haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude));
_haze->setHazeKeyLightRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange));
_haze->setHazeKeyLightAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude));
_haze->setHazeBackgroundBlend(config.hazeBackgroundBlend);
}
@ -86,7 +86,7 @@ void HazeStageSetup::run(const render::RenderContextPointer& renderContext) {
}
}
void FetchHazeStage::run(const render::RenderContextPointer& renderContext, model::HazePointer& haze) {
void FetchHazeStage::run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze) {
auto hazeStage = renderContext->_scene->getStage<HazeStage>();
assert(hazeStage);

View file

@ -31,8 +31,8 @@ public:
static const Index INVALID_INDEX;
static bool isIndexInvalid(Index index) { return index == INVALID_INDEX; }
using HazePointer = model::HazePointer;
using Hazes = render::indexed_container::IndexedPointerVector<model::Haze>;
using HazePointer = graphics::HazePointer;
using Hazes = render::indexed_container::IndexedPointerVector<graphics::Haze>;
using HazeMap = std::unordered_map<HazePointer, Index>;
using HazeIndices = std::vector<Index>;
@ -106,11 +106,11 @@ class FetchHazeConfig : public render::Job::Config {
public:
FetchHazeConfig() : render::Job::Config() {}
glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR };
float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE };
glm::vec3 hazeColor{ graphics::Haze::INITIAL_HAZE_COLOR };
float hazeGlareAngle{ graphics::Haze::INITIAL_HAZE_GLARE_ANGLE };
glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR };
float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE };
glm::vec3 hazeGlareColor{ graphics::Haze::INITIAL_HAZE_GLARE_COLOR };
float hazeBaseReference{ graphics::Haze::INITIAL_HAZE_BASE_REFERENCE };
bool isHazeActive{ false };
bool isAltitudeBased{ false };
@ -118,13 +118,13 @@ public:
bool isModulateColorActive{ false };
bool isHazeEnableGlare{ false };
float hazeRange{ model::Haze::INITIAL_HAZE_RANGE };
float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT };
float hazeRange{ graphics::Haze::INITIAL_HAZE_RANGE };
float hazeHeight{ graphics::Haze::INITIAL_HAZE_HEIGHT };
float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE };
float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE };
float hazeKeyLightRange{ graphics::Haze::INITIAL_KEY_LIGHT_RANGE };
float hazeKeyLightAltitude{ graphics::Haze::INITIAL_KEY_LIGHT_ALTITUDE };
float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND };
float hazeBackgroundBlend{ graphics::Haze::INITIAL_HAZE_BACKGROUND_BLEND };
public slots:
void setHazeColor(const glm::vec3 value) { hazeColor = value; emit dirty(); }
@ -154,15 +154,15 @@ signals:
class FetchHazeStage {
public:
using Config = FetchHazeConfig;
using JobModel = render::Job::ModelO<FetchHazeStage, model::HazePointer, Config>;
using JobModel = render::Job::ModelO<FetchHazeStage, graphics::HazePointer, Config>;
FetchHazeStage();
void configure(const Config& config);
void run(const render::RenderContextPointer& renderContext, model::HazePointer& haze);
void run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze);
private:
model::HazePointer _haze;
graphics::HazePointer _haze;
gpu::PipelinePointer _hazePipeline;
};
#endif

View file

@ -40,7 +40,7 @@ namespace render {
}
LightPayload::LightPayload() :
_light(std::make_shared<model::Light>())
_light(std::make_shared<graphics::Light>())
{
}
@ -109,7 +109,7 @@ namespace render {
}
KeyLightPayload::KeyLightPayload() :
_light(std::make_shared<model::Light>())
_light(std::make_shared<graphics::Light>())
{
}

View file

@ -26,14 +26,14 @@ public:
~LightPayload();
void render(RenderArgs* args);
model::LightPointer editLight() { _needUpdate = true; return _light; }
graphics::LightPointer editLight() { _needUpdate = true; return _light; }
render::Item::Bound& editBound() { _needUpdate = true; return _bound; }
void setVisible(bool visible) { _isVisible = visible; }
bool isVisible() const { return _isVisible; }
protected:
model::LightPointer _light;
graphics::LightPointer _light;
render::Item::Bound _bound;
LightStagePointer _stage;
LightStage::Index _index { LightStage::INVALID_INDEX };
@ -56,7 +56,7 @@ public:
~KeyLightPayload();
void render(RenderArgs* args);
model::LightPointer editLight() { _needUpdate = true; return _light; }
graphics::LightPointer editLight() { _needUpdate = true; return _light; }
render::Item::Bound& editBound() { _needUpdate = true; return _bound; }
void setVisible(bool visible) { _isVisible = visible; }
@ -69,7 +69,7 @@ public:
bool _pendingAmbientTexture { false };
protected:
model::LightPointer _light;
graphics::LightPointer _light;
render::Item::Bound _bound;
LightStagePointer _stage;
LightStage::Index _index { LightStage::INVALID_INDEX };

View file

@ -29,32 +29,32 @@ const LightStage::Index LightStage::INVALID_INDEX { render::indexed_container::I
LightStage::LightStage() {
// Add off lights
const LightPointer ambientOffLight { std::make_shared<model::Light>() };
const LightPointer ambientOffLight { std::make_shared<graphics::Light>() };
ambientOffLight->setAmbientIntensity(0.0f);
ambientOffLight->setColor(model::Vec3(0.0));
ambientOffLight->setColor(graphics::Vec3(0.0));
ambientOffLight->setIntensity(0.0f);
ambientOffLight->setType(model::Light::Type::AMBIENT);
ambientOffLight->setType(graphics::Light::Type::AMBIENT);
_ambientOffLightId = addLight(ambientOffLight);
const LightPointer pointOffLight { std::make_shared<model::Light>() };
const LightPointer pointOffLight { std::make_shared<graphics::Light>() };
pointOffLight->setAmbientIntensity(0.0f);
pointOffLight->setColor(model::Vec3(0.0));
pointOffLight->setColor(graphics::Vec3(0.0));
pointOffLight->setIntensity(0.0f);
pointOffLight->setType(model::Light::Type::POINT);
pointOffLight->setType(graphics::Light::Type::POINT);
_pointOffLightId = addLight(pointOffLight);
const LightPointer spotOffLight { std::make_shared<model::Light>() };
const LightPointer spotOffLight { std::make_shared<graphics::Light>() };
spotOffLight->setAmbientIntensity(0.0f);
spotOffLight->setColor(model::Vec3(0.0));
spotOffLight->setColor(graphics::Vec3(0.0));
spotOffLight->setIntensity(0.0f);
spotOffLight->setType(model::Light::Type::SPOT);
spotOffLight->setType(graphics::Light::Type::SPOT);
_spotOffLightId = addLight(spotOffLight);
const LightPointer sunOffLight { std::make_shared<model::Light>() };
const LightPointer sunOffLight { std::make_shared<graphics::Light>() };
sunOffLight->setAmbientIntensity(0.0f);
sunOffLight->setColor(model::Vec3(0.0));
sunOffLight->setColor(graphics::Vec3(0.0));
sunOffLight->setIntensity(0.0f);
sunOffLight->setType(model::Light::Type::SUN);
sunOffLight->setType(graphics::Light::Type::SUN);
_sunOffLightId = addLight(sunOffLight);
// Set default light to the off ambient light (until changed)
@ -123,7 +123,7 @@ float LightStage::Shadow::Cascade::computeFarDistance(const ViewFrustum& viewFru
return far;
}
LightStage::Shadow::Shadow(model::LightPointer light, float maxDistance, unsigned int cascadeCount) :
LightStage::Shadow::Shadow(graphics::LightPointer light, float maxDistance, unsigned int cascadeCount) :
_light{ light } {
cascadeCount = std::min(cascadeCount, (unsigned int)SHADOW_CASCADE_MAX_COUNT);
Schema schema;
@ -404,14 +404,14 @@ LightStage::Index LightStage::getShadowId(Index lightId) const {
}
void LightStage::updateLightArrayBuffer(Index lightId) {
auto lightSize = sizeof(model::Light::LightSchema);
auto lightSize = sizeof(graphics::Light::LightSchema);
if (!_lightArrayBuffer) {
_lightArrayBuffer = std::make_shared<gpu::Buffer>(lightSize);
}
assert(checkLightId(lightId));
if (lightId > (Index)_lightArrayBuffer->getNumTypedElements<model::Light::LightSchema>()) {
if (lightId > (Index)_lightArrayBuffer->getNumTypedElements<graphics::Light::LightSchema>()) {
_lightArrayBuffer->resize(lightSize * (lightId + 10));
}
@ -419,7 +419,7 @@ void LightStage::updateLightArrayBuffer(Index lightId) {
auto light = _lights._elements[lightId];
if (light) {
const auto& lightSchema = light->getLightSchemaBuffer().get();
_lightArrayBuffer->setSubData<model::Light::LightSchema>(lightId, lightSchema);
_lightArrayBuffer->setSubData<graphics::Light::LightSchema>(lightId, lightSchema);
} else {
// this should not happen ?
}

View file

@ -35,8 +35,8 @@ public:
static const Index INVALID_INDEX;
static bool isIndexInvalid(Index index) { return index == INVALID_INDEX; }
using LightPointer = model::LightPointer;
using Lights = render::indexed_container::IndexedPointerVector<model::Light>;
using LightPointer = graphics::LightPointer;
using Lights = render::indexed_container::IndexedPointerVector<graphics::Light>;
using LightMap = std::unordered_map<LightPointer, Index>;
using LightIndices = std::vector<Index>;
@ -75,7 +75,7 @@ public:
float left, float right, float bottom, float top, float viewMaxShadowDistance) const;
};
Shadow(model::LightPointer light, float maxDistance, unsigned int cascadeCount = 1);
Shadow(graphics::LightPointer light, float maxDistance, unsigned int cascadeCount = 1);
void setKeylightFrustum(const ViewFrustum& viewFrustum,
float nearDepth = 1.0f, float farDepth = 1000.0f);
@ -91,7 +91,7 @@ public:
float getMaxDistance() const { return _maxDistance; }
void setMaxDistance(float value);
const model::LightPointer& getLight() const { return _light; }
const graphics::LightPointer& getLight() const { return _light; }
protected:
@ -101,7 +101,7 @@ public:
static const glm::mat4 _biasMatrix;
model::LightPointer _light;
graphics::LightPointer _light;
float _maxDistance;
Cascades _cascades;
@ -165,12 +165,12 @@ public:
Frame() {}
void clear() { _pointLights.clear(); _spotLights.clear(); _sunLights.clear(); _ambientLights.clear(); }
void pushLight(LightStage::Index index, model::Light::Type type) {
void pushLight(LightStage::Index index, graphics::Light::Type type) {
switch (type) {
case model::Light::POINT: { pushPointLight(index); break; }
case model::Light::SPOT: { pushSpotLight(index); break; }
case model::Light::SUN: { pushSunLight(index); break; }
case model::Light::AMBIENT: { pushAmbientLight(index); break; }
case graphics::Light::POINT: { pushPointLight(index); break; }
case graphics::Light::SPOT: { pushSpotLight(index); break; }
case graphics::Light::SUN: { pushSunLight(index); break; }
case graphics::Light::AMBIENT: { pushAmbientLight(index); break; }
default: { break; }
}
}

View file

@ -45,17 +45,17 @@ template <> void payloadRender(const MeshPartPayload::Pointer& payload, RenderAr
}
}
MeshPartPayload::MeshPartPayload(const std::shared_ptr<const model::Mesh>& mesh, int partIndex, model::MaterialPointer material) {
MeshPartPayload::MeshPartPayload(const std::shared_ptr<const graphics::Mesh>& mesh, int partIndex, graphics::MaterialPointer material) {
updateMeshPart(mesh, partIndex);
updateMaterial(material);
}
void MeshPartPayload::updateMeshPart(const std::shared_ptr<const model::Mesh>& drawMesh, int partIndex) {
void MeshPartPayload::updateMeshPart(const std::shared_ptr<const graphics::Mesh>& drawMesh, int partIndex) {
_drawMesh = drawMesh;
if (_drawMesh) {
auto vertexFormat = _drawMesh->getVertexFormat();
_hasColorAttrib = vertexFormat->hasAttribute(gpu::Stream::COLOR);
_drawPart = _drawMesh->getPartBuffer().get<model::Mesh::Part>(partIndex);
_drawPart = _drawMesh->getPartBuffer().get<graphics::Mesh::Part>(partIndex);
_localBound = _drawMesh->evalPartBound(partIndex);
}
}
@ -67,7 +67,7 @@ void MeshPartPayload::updateTransform(const Transform& transform, const Transfor
_worldBound.transform(_drawTransform);
}
void MeshPartPayload::updateMaterial(model::MaterialPointer drawMaterial) {
void MeshPartPayload::updateMaterial(graphics::MaterialPointer drawMaterial) {
_drawMaterial = drawMaterial;
}
@ -90,7 +90,7 @@ Item::Bound MeshPartPayload::getBound() const {
}
ShapeKey MeshPartPayload::getShapeKey() const {
model::MaterialKey drawMaterialKey;
graphics::MaterialKey drawMaterialKey;
if (_drawMaterial) {
drawMaterialKey = _drawMaterial->getKey();
}
@ -156,7 +156,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
// Albedo
if (materialKey.isAlbedoMap()) {
auto itr = textureMaps.find(model::MaterialKey::ALBEDO_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::ALBEDO_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, itr->second->getTextureView());
} else {
@ -166,7 +166,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
// Roughness map
if (materialKey.isRoughnessMap()) {
auto itr = textureMaps.find(model::MaterialKey::ROUGHNESS_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::ROUGHNESS_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, itr->second->getTextureView());
@ -178,7 +178,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
// Normal map
if (materialKey.isNormalMap()) {
auto itr = textureMaps.find(model::MaterialKey::NORMAL_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::NORMAL_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, itr->second->getTextureView());
@ -190,7 +190,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
// Metallic map
if (materialKey.isMetallicMap()) {
auto itr = textureMaps.find(model::MaterialKey::METALLIC_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::METALLIC_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, itr->second->getTextureView());
@ -202,7 +202,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
// Occlusion map
if (materialKey.isOcclusionMap()) {
auto itr = textureMaps.find(model::MaterialKey::OCCLUSION_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::OCCLUSION_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, itr->second->getTextureView());
@ -214,7 +214,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
// Scattering map
if (materialKey.isScatteringMap()) {
auto itr = textureMaps.find(model::MaterialKey::SCATTERING_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::SCATTERING_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, itr->second->getTextureView());
@ -226,7 +226,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
// Emissive / Lightmap
if (materialKey.isLightmapMap()) {
auto itr = textureMaps.find(model::MaterialKey::LIGHTMAP_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::LIGHTMAP_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView());
@ -234,7 +234,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getGrayTexture());
}
} else if (materialKey.isEmissiveMap()) {
auto itr = textureMaps.find(model::MaterialKey::EMISSIVE_MAP);
auto itr = textureMaps.find(graphics::MaterialKey::EMISSIVE_MAP);
if (itr != textureMaps.end() && itr->second->isDefined()) {
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView());
@ -439,7 +439,7 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe
return;
}
model::MaterialKey drawMaterialKey;
graphics::MaterialKey drawMaterialKey;
if (_drawMaterial) {
drawMaterialKey = _drawMaterial->getKey();
}

View file

@ -28,17 +28,17 @@ class Model;
class MeshPartPayload {
public:
MeshPartPayload() {}
MeshPartPayload(const std::shared_ptr<const model::Mesh>& mesh, int partIndex, model::MaterialPointer material);
MeshPartPayload(const std::shared_ptr<const graphics::Mesh>& mesh, int partIndex, graphics::MaterialPointer material);
typedef render::Payload<MeshPartPayload> Payload;
typedef Payload::DataPointer Pointer;
virtual void updateMeshPart(const std::shared_ptr<const model::Mesh>& drawMesh, int partIndex);
virtual void updateMeshPart(const std::shared_ptr<const graphics::Mesh>& drawMesh, int partIndex);
virtual void notifyLocationChanged() {}
void updateTransform(const Transform& transform, const Transform& offsetTransform);
virtual void updateMaterial(model::MaterialPointer drawMaterial);
virtual void updateMaterial(graphics::MaterialPointer drawMaterial);
// Render Item interface
virtual render::ItemKey getKey() const;
@ -58,13 +58,13 @@ public:
int _partIndex = 0;
bool _hasColorAttrib { false };
model::Box _localBound;
model::Box _adjustedLocalBound;
mutable model::Box _worldBound;
std::shared_ptr<const model::Mesh> _drawMesh;
graphics::Box _localBound;
graphics::Box _adjustedLocalBound;
mutable graphics::Box _worldBound;
std::shared_ptr<const graphics::Mesh> _drawMesh;
std::shared_ptr<const model::Material> _drawMaterial;
model::Mesh::Part _drawPart;
std::shared_ptr<const graphics::Material> _drawMaterial;
graphics::Mesh::Part _drawPart;
size_t getVerticesCount() const { return _drawMesh ? _drawMesh->getNumVertices() : 0; }
size_t getMaterialTextureSize() { return _drawMaterial ? _drawMaterial->getTextureSize() : 0; }

View file

@ -46,7 +46,7 @@ float Model::FAKE_DIMENSION_PLACEHOLDER = -1.0f;
#define HTTP_INVALID_COM "http://invalid.com"
const int NUM_COLLISION_HULL_COLORS = 24;
std::vector<model::MaterialPointer> _collisionMaterials;
std::vector<graphics::MaterialPointer> _collisionMaterials;
void initCollisionMaterials() {
// generates bright colors in red, green, blue, yellow, magenta, and cyan spectrums
@ -72,8 +72,8 @@ void initCollisionMaterials() {
// so they don't tend to group together for large models
for (int i = 0; i < sectionWidth; ++i) {
for (int j = 0; j < numComponents; ++j) {
model::MaterialPointer material;
material = std::make_shared<model::Material>();
graphics::MaterialPointer material;
material = std::make_shared<graphics::Material>();
int index = j * sectionWidth + i;
float red = component[index];
float green = component[(index + greenPhase) % NUM_COLLISION_HULL_COLORS];
@ -559,7 +559,7 @@ MeshProxyList Model::getMeshes() const {
offset.postTranslate(_offset);
glm::mat4 offsetMat = offset.getMatrix();
for (std::shared_ptr<const model::Mesh> mesh : meshes) {
for (std::shared_ptr<const graphics::Mesh> mesh : meshes) {
if (!mesh) {
continue;
}
@ -1481,7 +1481,7 @@ void Model::createCollisionRenderItemSet() {
// Create the render payloads
int numParts = (int)mesh->getNumParts();
for (int partIndex = 0; partIndex < numParts; partIndex++) {
model::MaterialPointer& material = _collisionMaterials[partIndex % NUM_COLLISION_HULL_COLORS];
graphics::MaterialPointer& material = _collisionMaterials[partIndex % NUM_COLLISION_HULL_COLORS];
auto payload = std::make_shared<MeshPartPayload>(mesh, partIndex, material);
payload->updateTransform(identity, offset);
_collisionRenderItems << payload;
@ -1495,7 +1495,7 @@ bool Model::isRenderable() const {
class CollisionRenderGeometry : public Geometry {
public:
CollisionRenderGeometry(model::MeshPointer mesh) {
CollisionRenderGeometry(graphics::MeshPointer mesh) {
_fbxGeometry = std::make_shared<FBXGeometry>();
std::shared_ptr<GeometryMeshes> meshes = std::make_shared<GeometryMeshes>();
meshes->push_back(mesh);
@ -1504,7 +1504,7 @@ public:
}
};
void Model::setCollisionMesh(model::MeshPointer mesh) {
void Model::setCollisionMesh(graphics::MeshPointer mesh) {
if (mesh) {
_collisionGeometry = std::make_shared<CollisionRenderGeometry>(mesh);
} else {

View file

@ -240,7 +240,7 @@ public:
// returns 'true' if needs fullUpdate after geometry change
virtual bool updateGeometry();
void setCollisionMesh(model::MeshPointer mesh);
void setCollisionMesh(graphics::MeshPointer mesh);
void setLoadingPriority(float priority) { _loadingPriority = priority; }

View file

@ -338,7 +338,7 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs&
// Setup haze iff curretn zone has haze
auto hazeStage = args->_scene->getStage<HazeStage>();
if (hazeStage && hazeStage->_currentFrame._hazes.size() > 0) {
model::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front());
graphics::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front());
batch.setUniformBuffer(render::ShapePipeline::Slot::HAZE_MODEL, hazePointer->getHazeParametersBuffer());
}

View file

@ -546,7 +546,7 @@ void batchSetter(const ShapePipeline& pipeline, gpu::Batch& batch, RenderArgs* a
if (pipeline.locations->materialBufferUnit >= 0) {
// Create a default schema
static bool isMaterialSet = false;
static model::Material material;
static graphics::Material material;
if (!isMaterialSet) {
material.setAlbedo(vec3(1.0f));
material.setOpacity(1.0f);

View file

@ -271,7 +271,7 @@ void RenderShadowCascadeSetup::run(const render::RenderContextPointer& renderCon
// Set the keylight render args
args->pushViewFrustum(*(globalShadow->getCascade(_cascadeIndex).getFrustum()));
args->_renderMode = RenderArgs::SHADOW_RENDER_MODE;
if (lightStage->getCurrentKeyLight()->getType() == model::Light::SUN) {
if (lightStage->getCurrentKeyLight()->getType() == graphics::Light::SUN) {
const float shadowSizeScale = 1e16f;
// Set the size scale to a ridiculously high value to prevent small object culling which assumes
// the view frustum is a perspective projection. But this isn't the case for the sun which

View file

@ -26,7 +26,7 @@ void PrepareStencil::configure(const Config& config) {
_forceDraw = config.forceDraw;
}
model::MeshPointer PrepareStencil::getMesh() {
graphics::MeshPointer PrepareStencil::getMesh() {
if (!_mesh) {
std::vector<glm::vec3> vertices {
@ -36,7 +36,7 @@ model::MeshPointer PrepareStencil::getMesh() {
{ 1.0f, -1.0f, 0.0f }, { 0.0f, -1.0f, 0.0f } };
std::vector<uint32_t> indices { 0, 7, 1, 1, 3, 2, 3, 5, 4, 5, 7, 6 };
_mesh = model::Mesh::createIndexedTriangles_P3F((uint32_t) vertices.size(), (uint32_t) indices.size(), vertices.data(), indices.data());
_mesh = graphics::Mesh::createIndexedTriangles_P3F((uint32_t) vertices.size(), (uint32_t) indices.size(), vertices.data(), indices.data());
}
return _mesh;
}
@ -95,7 +95,7 @@ void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::F
batch.setInputStream(0, mesh->getVertexStream());
// Draw
auto part = mesh->getPartBuffer().get<model::Mesh::Part>(0);
auto part = mesh->getPartBuffer().get<graphics::Mesh::Part>(0);
batch.drawIndexed(gpu::TRIANGLES, part._numIndices, part._startIndex);
} else {
batch.setPipeline(getPaintStencilPipeline());

View file

@ -63,8 +63,8 @@ private:
gpu::PipelinePointer _paintStencilPipeline;
gpu::PipelinePointer getPaintStencilPipeline();
model::MeshPointer _mesh;
model::MeshPointer getMesh();
graphics::MeshPointer _mesh;
graphics::MeshPointer getMesh();
int _maskMode { 0 };
bool _forceDraw { false };

View file

@ -145,14 +145,14 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
auto deferredTransform = inputs;
auto lightStage = context->_scene->getStage<LightStage>(LightStage::getName());
std::vector<model::LightPointer> keyLightStack;
std::vector<graphics::LightPointer> keyLightStack;
if (lightStage && lightStage->_currentFrame._sunLights.size()) {
for (auto index : lightStage->_currentFrame._sunLights) {
keyLightStack.push_back(lightStage->getLight(index));
}
}
std::vector<model::LightPointer> ambientLightStack;
std::vector<graphics::LightPointer> ambientLightStack;
if (lightStage && lightStage->_currentFrame._ambientLights.size()) {
for (auto index : lightStage->_currentFrame._ambientLights) {
ambientLightStack.push_back(lightStage->getLight(index));
@ -160,7 +160,7 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
}
auto backgroundStage = context->_scene->getStage<BackgroundStage>(BackgroundStage::getName());
std::vector<model::SkyboxPointer> skyboxStack;
std::vector<graphics::SkyboxPointer> skyboxStack;
if (backgroundStage && backgroundStage->_currentFrame._backgrounds.size()) {
for (auto index : backgroundStage->_currentFrame._backgrounds) {
auto background = backgroundStage->getBackground(index);

View file

@ -102,7 +102,7 @@ QScriptValue ModelScriptingInterface::appendMeshes(MeshProxyList in) {
indexStartOffset += numVertices;
}
model::MeshPointer result(new model::Mesh());
graphics::MeshPointer result(new graphics::Mesh());
gpu::Element vertexElement = gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ);
gpu::Buffer* combinedVertexBuffer = new gpu::Buffer(combinedVertexSize, combinedVertexData.get());
@ -130,12 +130,12 @@ QScriptValue ModelScriptingInterface::appendMeshes(MeshProxyList in) {
gpu::BufferView combinedIndexesBufferView(combinedIndexesBufferPointer, indexElement);
result->setIndexBuffer(combinedIndexesBufferView);
std::vector<model::Mesh::Part> parts;
parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex
(model::Index)result->getNumIndices(), // numIndices
(model::Index)0, // baseVertex
model::Mesh::TRIANGLES)); // topology
result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part),
std::vector<graphics::Mesh::Part> parts;
parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex
(graphics::Index)result->getNumIndices(), // numIndices
(graphics::Index)0, // baseVertex
graphics::Mesh::TRIANGLES)); // topology
result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part),
(gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
@ -153,7 +153,7 @@ QScriptValue ModelScriptingInterface::transformMesh(glm::mat4 transform, MeshPro
}
const auto inverseTransposeTransform = glm::inverse(glm::transpose(transform));
model::MeshPointer result = mesh->map([&](glm::vec3 position){ return glm::vec3(transform * glm::vec4(position, 1.0f)); },
graphics::MeshPointer result = mesh->map([&](glm::vec3 position){ return glm::vec3(transform * glm::vec4(position, 1.0f)); },
[&](glm::vec3 color){ return color; },
[&](glm::vec3 normal){ return glm::vec3(inverseTransposeTransform * glm::vec4(normal, 0.0f)); },
[&](uint32_t index){ return index; });
@ -199,7 +199,7 @@ QScriptValue ModelScriptingInterface::getVertex(MeshProxy* meshProxy, int vertex
QScriptValue ModelScriptingInterface::newMesh(const QVector<glm::vec3>& vertices,
const QVector<glm::vec3>& normals,
const QVector<MeshFace>& faces) {
model::MeshPointer mesh(new model::Mesh());
graphics::MeshPointer mesh(new graphics::Mesh());
// vertices
auto vertexBuffer = std::make_shared<gpu::Buffer>(vertices.size() * sizeof(glm::vec3), (gpu::Byte*)vertices.data());
@ -236,12 +236,12 @@ QScriptValue ModelScriptingInterface::newMesh(const QVector<glm::vec3>& vertices
mesh->setIndexBuffer(indexBufferView);
// parts
std::vector<model::Mesh::Part> parts;
parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex
(model::Index)faces.size() * 3, // numIndices
(model::Index)0, // baseVertex
model::Mesh::TRIANGLES)); // topology
mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part),
std::vector<graphics::Mesh::Part> parts;
parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex
(graphics::Index)faces.size() * 3, // numIndices
(graphics::Index)0, // baseVertex
graphics::Mesh::TRIANGLES)); // topology
mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part),
(gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));

View file

@ -112,17 +112,17 @@ bool SceneScripting::Stage::isSunModelEnabled() const {
void SceneScripting::Stage::setBackgroundMode(const QString& mode) {
if (mode == QString("inherit")) {
_skyStage->setBackgroundMode(model::SunSkyStage::NO_BACKGROUND);
_skyStage->setBackgroundMode(graphics::SunSkyStage::NO_BACKGROUND);
} else if (mode == QString("skybox")) {
_skyStage->setBackgroundMode(model::SunSkyStage::SKY_BOX);
_skyStage->setBackgroundMode(graphics::SunSkyStage::SKY_BOX);
}
}
QString SceneScripting::Stage::getBackgroundMode() const {
switch (_skyStage->getBackgroundMode()) {
case model::SunSkyStage::NO_BACKGROUND:
case graphics::SunSkyStage::NO_BACKGROUND:
return QString("inherit");
case model::SunSkyStage::SKY_BOX:
case graphics::SunSkyStage::SKY_BOX:
return QString("skybox");
default:
return QString("inherit");
@ -131,7 +131,7 @@ QString SceneScripting::Stage::getBackgroundMode() const {
SceneScriptingInterface::SceneScriptingInterface() : _stage{ new SceneScripting::Stage{ _skyStage } } {
// Let's make sure the sunSkyStage is using a proceduralSkybox
_skyStage->setSkybox(model::SkyboxPointer(new ProceduralSkybox()));
_skyStage->setSkybox(graphics::SkyboxPointer(new ProceduralSkybox()));
}
void SceneScriptingInterface::setShouldRenderAvatars(bool shouldRenderAvatars) {
@ -148,6 +148,6 @@ void SceneScriptingInterface::setShouldRenderEntities(bool shouldRenderEntities)
}
}
model::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const {
graphics::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const {
return _skyStage;
}

View file

@ -23,7 +23,7 @@ namespace SceneScripting {
Q_OBJECT
public:
Location(model::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {}
Location(graphics::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {}
Q_PROPERTY(float longitude READ getLongitude WRITE setLongitude)
Q_PROPERTY(float latitude READ getLatitude WRITE setLatitude)
@ -37,7 +37,7 @@ namespace SceneScripting {
void setAltitude(float altitude);
protected:
model::SunSkyStagePointer _skyStage;
graphics::SunSkyStagePointer _skyStage;
};
using LocationPointer = std::unique_ptr<Location>;
@ -45,7 +45,7 @@ namespace SceneScripting {
Q_OBJECT
public:
Time(model::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {}
Time(graphics::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {}
Q_PROPERTY(float hour READ getHour WRITE setHour)
Q_PROPERTY(int day READ getDay WRITE setDay)
@ -56,7 +56,7 @@ namespace SceneScripting {
void setDay(int day);
protected:
model::SunSkyStagePointer _skyStage;
graphics::SunSkyStagePointer _skyStage;
};
using TimePointer = std::unique_ptr<Time>;
@ -64,7 +64,7 @@ namespace SceneScripting {
Q_OBJECT
public:
KeyLight(model::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {}
KeyLight(graphics::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {}
Q_PROPERTY(glm::vec3 color READ getColor WRITE setColor)
Q_PROPERTY(float intensity READ getIntensity WRITE setIntensity)
@ -87,7 +87,7 @@ namespace SceneScripting {
void setAmbientMap(const gpu::TexturePointer& map);
protected:
model::SunSkyStagePointer _skyStage;
graphics::SunSkyStagePointer _skyStage;
};
using KeyLightPointer = std::unique_ptr<KeyLight>;
@ -95,7 +95,7 @@ namespace SceneScripting {
Q_OBJECT
public:
Stage(model::SunSkyStagePointer skyStage)
Stage(graphics::SunSkyStagePointer skyStage)
: _skyStage{ skyStage },
_location{ new Location{ skyStage } }, _time{ new Time{ skyStage } }, _keyLight{ new KeyLight{ skyStage } }{}
@ -122,7 +122,7 @@ namespace SceneScripting {
QString getBackgroundMode() const;
protected:
model::SunSkyStagePointer _skyStage;
graphics::SunSkyStagePointer _skyStage;
LocationPointer _location;
TimePointer _time;
KeyLightPointer _keyLight;
@ -146,7 +146,7 @@ public:
Q_PROPERTY(SceneScripting::Stage* stage READ getStage)
SceneScripting::Stage* getStage() const { return _stage.get(); }
model::SunSkyStagePointer getSkyStage() const;
graphics::SunSkyStagePointer getSkyStage() const;
signals:
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
@ -156,7 +156,7 @@ protected:
SceneScriptingInterface();
~SceneScriptingInterface() {};
model::SunSkyStagePointer _skyStage = std::make_shared<model::SunSkyStage>();
graphics::SunSkyStagePointer _skyStage = std::make_shared<graphics::SunSkyStage>();
SceneScripting::StagePointer _stage;
bool _shouldRenderAvatars = true;

View file

@ -315,11 +315,11 @@ Q_DECLARE_METATYPE(AnimationDetails);
QScriptValue animationDetailsToScriptValue(QScriptEngine* engine, const AnimationDetails& event);
void animationDetailsFromScriptValue(const QScriptValue& object, AnimationDetails& event);
namespace model {
namespace graphics {
class Mesh;
}
using MeshPointer = std::shared_ptr<model::Mesh>;
using MeshPointer = std::shared_ptr<graphics::Mesh>;
class MeshProxy : public QObject {

View file

@ -210,7 +210,7 @@ private:
bool _hmdDesktopTracking { false };
glm::mat4 _resetMat { glm::mat4() };
model::Geometry _modelGeometry;
graphics::Geometry _modelGeometry;
gpu::TexturePointer _texture;
int _leftHandRenderID { 0 };

View file

@ -15,7 +15,7 @@ class FBXGeometry;
class TestFbx : public GpuTestBase {
size_t _partCount { 0 };
model::Material _material;
graphics::Material _material;
render::ShapeKey _shapeKey;
std::vector<mat4> _partTransforms;
render::ShapePlumberPointer _shapePlumber;

View file

@ -44,7 +44,7 @@ TestWindow::TestWindow() {
});
#ifdef DEFERRED_LIGHTING
_light->setType(model::Light::SUN);
_light->setType(graphics::Light::SUN);
_light->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE);
_light->setIntensity(1.0f);
_light->setAmbientIntensity(0.5f);

View file

@ -33,7 +33,7 @@ protected:
render::ShapePlumberPointer _shapePlumber { std::make_shared<render::ShapePlumber>() };
render::RenderContextPointer _renderContext{ std::make_shared<render::RenderContext>() };
gpu::PipelinePointer _opaquePipeline;
model::LightPointer _light { std::make_shared<model::Light>() };
graphics::LightPointer _light { std::make_shared<graphics::Light>() };
GenerateDeferredFrameTransform _generateDeferredFrameTransform;
MakeLightingModel _generateLightingModel;

View file

@ -140,12 +140,12 @@ void CollisionRenderMeshCacheTests::testCompoundShape() {
QVERIFY(cache.getNumMeshes() == 0);
// get the mesh once
model::MeshPointer mesh = cache.getMesh(compoundShape);
graphics::MeshPointer mesh = cache.getMesh(compoundShape);
QVERIFY((bool)mesh);
QVERIFY(cache.getNumMeshes() == 1);
// get the mesh again
model::MeshPointer mesh2 = cache.getMesh(compoundShape);
graphics::MeshPointer mesh2 = cache.getMesh(compoundShape);
QVERIFY(mesh2 == mesh);
QVERIFY(cache.getNumMeshes() == 1);
@ -214,18 +214,18 @@ void CollisionRenderMeshCacheTests::testMultipleShapes() {
QVERIFY(cache.getNumMeshes() == 0);
// get the meshes
model::MeshPointer meshA = cache.getMesh(shapeA);
model::MeshPointer meshB = cache.getMesh(shapeB);
model::MeshPointer meshC = cache.getMesh(shapeC);
graphics::MeshPointer meshA = cache.getMesh(shapeA);
graphics::MeshPointer meshB = cache.getMesh(shapeB);
graphics::MeshPointer meshC = cache.getMesh(shapeC);
QVERIFY((bool)meshA);
QVERIFY((bool)meshB);
QVERIFY((bool)meshC);
QVERIFY(cache.getNumMeshes() == 3);
// get the meshes again
model::MeshPointer meshA2 = cache.getMesh(shapeA);
model::MeshPointer meshB2 = cache.getMesh(shapeB);
model::MeshPointer meshC2 = cache.getMesh(shapeC);
graphics::MeshPointer meshA2 = cache.getMesh(shapeA);
graphics::MeshPointer meshB2 = cache.getMesh(shapeB);
graphics::MeshPointer meshC2 = cache.getMesh(shapeC);
QVERIFY(meshA == meshA2);
QVERIFY(meshB == meshB2);
QVERIFY(meshC == meshC2);

View file

@ -416,7 +416,7 @@ namespace render {
auto backgroundMode = skyStage->getBackgroundMode();
switch (backgroundMode) {
case model::SunSkyStage::SKY_BOX: {
case graphics::SunSkyStage::SKY_BOX: {
auto skybox = skyStage->getSkybox();
if (skybox) {
PerformanceTimer perfTimer("skybox");
@ -1114,8 +1114,8 @@ private:
RenderThread _renderThread;
QWindowCamera _camera;
ViewFrustum _viewFrustum; // current state of view frustum, perspective, orientation, etc.
model::SunSkyStage _sunSkyStage;
model::LightPointer _globalLight { std::make_shared<model::Light>() };
graphics::SunSkyStage _sunSkyStage;
graphics::LightPointer _globalLight { std::make_shared<graphics::Light>() };
bool _ready { false };
EntitySimulationPointer _entitySimulation;