This commit is contained in:
Jack Andersen 2016-01-17 14:41:05 -10:00
commit 99e3f733be
8 changed files with 137 additions and 11 deletions

View File

@ -673,6 +673,7 @@ def make_pass_inca():
new_grp.links.new(grp_in.outputs[0], add1.inputs[1])
new_grp.links.new(grp_in.outputs[2], add1.inputs[2])
new_grp.links.new(add1.outputs[0], grp_out.inputs[0])
new_grp.links.new(grp_in.outputs[1], grp_out.inputs[1])
grp_out.inputs[1].default_value = 1.0
# Reflection Map

View File

@ -64,13 +64,13 @@ void MaterialSet::ConstructMaterial(Stream& out,
/* Blend factors */
if (material.header.flags.additiveBlending())
out << "new_material.game_settings.alpha_blend = 'ADD'\n"
if (material.header.flags.alphaBlending())
out << "new_material.game_settings.alpha_blend = 'ALPHA'\n"
"new_material.use_transparency = True\n"
"new_material.transparency_method = 'RAYTRACE'\n"
"new_material.alpha = 1.0\n";
else if (material.header.flags.alphaBlending())
out << "new_material.game_settings.alpha_blend = 'ALPHA'\n"
else if (material.header.flags.additiveBlending())
out << "new_material.game_settings.alpha_blend = 'ADD'\n"
"new_material.use_transparency = True\n"
"new_material.transparency_method = 'RAYTRACE'\n"
"new_material.alpha = 1.0\n";
@ -78,6 +78,7 @@ void MaterialSet::ConstructMaterial(Stream& out,
/* Texmap list */
out << "tex_maps = []\n"
"pnode = None\n"
"anode = None\n"
"rflv_tex_node = None\n";
/* Add PASSes */
@ -97,9 +98,13 @@ void MaterialSet::ConstructMaterial(Stream& out,
/* Connect final PASS */
out << "if pnode:\n"
" new_nodetree.links.new(pnode.outputs['Next Color'], final_node.inputs['Color'])\n"
" new_nodetree.links.new(pnode.outputs['Next Alpha'], final_node.inputs['Alpha'])\n"
"else:\n"
" new_nodetree.links.new(kcolor_nodes[-1][0].outputs[0], final_node.inputs['Color'])\n"
"if anode:\n"
" new_nodetree.links.new(anode.outputs['Value'], final_node.inputs['Alpha'])\n"
"elif pnode:\n"
" new_nodetree.links.new(pnode.outputs['Next Alpha'], final_node.inputs['Alpha'])\n"
"else:\n"
" new_nodetree.links.new(kcolor_nodes[-1][1].outputs[0], final_node.inputs['Alpha'])\n";
}
@ -278,7 +283,13 @@ void Material::SectionINT::constructNode(HECL::BlenderConnection::PyOutStream& o
switch (Subtype(subtype.toUint32()))
{
case Subtype::OPAC:
out.format("new_material.retro_opac = %d\n", value);
{
GX::Color clr(value);
out.format("anode = new_nodetree.nodes.new('ShaderNodeValue')\n"
"anode.outputs['Value'].default_value = %f\n",
float(clr[3]) / float(0xff));
out << "gridder.place_node(anode, 1)\n";
}
break;
case Subtype::BLOD:
out.format("new_material.retro_blod = %d\n", value);

View File

@ -27,7 +27,8 @@ add_executable(urde WIN32
ResourceBrowser.hpp ResourceBrowser.cpp atdna_ResourceBrowser.cpp
ModelViewer.hpp ModelViewer.cpp atdna_ModelViewer.cpp
ProjectManager.hpp ProjectManager.cpp
ViewManager.hpp ViewManager.cpp)
ViewManager.hpp ViewManager.cpp
Camera.hpp Camera.cpp)
target_link_libraries(urde
UrdeLocales

0
Editor/Camera.cpp Normal file
View File

36
Editor/Camera.hpp Normal file
View File

@ -0,0 +1,36 @@
#ifndef URDE_CAMERA_HPP
#define URDE_CAMERA_HPP
#include <CProjection.hpp>
#include <CFrustum.hpp>
#include <CQuaternion.hpp>
#include <CVector3f.hpp>
#include <Math.hpp>
namespace URDE
{
class Camera
{
Zeus::CFrustum m_frustum;
Zeus::CProjection m_projection;
Zeus::CVector3f m_position;
Zeus::CQuaternion m_orientation;
public:
Camera(const Zeus::CVector3f& position, Zeus::EProjType projType=Zeus::EProjType::Perspective,
const Zeus::CVector3f& up=Zeus::Math::kUpVec)
: m_position(position)
{
}
const Zeus::CMatrix4f& projectionMatrix() const { return m_projection.getCachedMatrix(); }
const Zeus::CProjection& projection() const { return m_projection; }
virtual void think()
{
}
};
}
#endif // URDE_CAMERA_HPP

View File

@ -1,8 +1,78 @@
#ifndef URDE_MODEL_VIEWER_HPP
#define URDE_MODEL_VIEWER_HPP
#include "Space.hpp"
#include "ViewManager.hpp"
#include "CVector3f.hpp"
#include "CProjection.hpp"
namespace URDE
{
class ModelViewer : public Space
{
struct State : Space::State
{
DECL_YAML
enum class Mode
{
Solid,
Material,
Wireframe
};
Value<Mode> renderMode = Mode::Material;
Value<Zeus::CVector3f> cameraPosition;
Value<Zeus::CQuaternion> cameraOrientation;
} m_state;
const Space::State& spaceState() const { return m_state; }
struct View : Specter::View
{
};
virtual Specter::View* buildContentView(Specter::ViewResources& res)
{
return nullptr;
}
virtual Specter::View* buildSpaceView(Specter::ViewResources& res)
{
return nullptr;
}
public:
ModelViewer(ViewManager& vm, Space* parent)
: Space(vm, Class::ModelViewer, parent)
{
reloadState();
}
ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other)
: ModelViewer(vm, parent)
{
m_state = other.m_state;
reloadState();
}
ModelViewer(ViewManager& vm, Space* parent, ConfigReader& r)
: ModelViewer(vm, parent)
{
m_state.read(r);
reloadState();
}
void reloadState()
{}
Space* copy(Space *parent) const
{
return new ModelViewer(m_vm, parent, *this);
}
bool usesToolbar() const { return true; }
};
}
#endif // URDE_MODEL_VIEWER_HPP

View File

@ -32,6 +32,7 @@ public:
SplitSpace,
TestSpace,
ResourceBrowser,
ModelViewer
};
struct State : Athena::io::DNAYaml<Athena::BigEndian> {Delete _d;};

View File

@ -24,10 +24,6 @@ SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res)
m_vm(vm),
m_textColor(res.themeData().uiText()),
m_textColorClear(m_textColor),
m_buildInfoStr(HECL::Format("%s: %s\n%s: %s\n%s: %s",
vm.translateOr("branch", "Branch").c_str(), GIT_BRANCH,
vm.translateOr("commit", "Commit").c_str(), GIT_COMMIT_HASH,
vm.translateOr("date", "Date").c_str(), GIT_COMMIT_DATE)),
m_newString(m_vm.translateOr("new_project", "New Project")),
m_newProjBind(*this),
m_openString(m_vm.translateOr("open_project", "Open Project")),
@ -35,6 +31,16 @@ SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res)
m_extractString(m_vm.translateOr("extract_game", "Extract Game")),
m_extractProjBind(*this)
{
if (GIT_COMMIT_DATE[0] != '\0' &&
GIT_COMMIT_HASH[0] != '\0' &&
GIT_BRANCH[0] != '\0')
{
m_buildInfoStr = HECL::Format("%s: %s\n%s: %s\n%s: %s",
vm.translateOr("branch", "Branch").c_str(), GIT_BRANCH,
vm.translateOr("commit", "Commit").c_str(), GIT_COMMIT_HASH,
vm.translateOr("date", "Date").c_str(), GIT_COMMIT_DATE);
}
m_openProjBind.m_openRecentMenuRoot.m_text = vm.translateOr("recent_projects", "Recent Projects");
m_textColorClear[3] = 0.0;
commitResources(res);