Example #1
0
ezResult ezTexConv2::ParseWrapModes()
{
  // cubemaps do not require any wrap mode settings
  if (m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Cubemap ||
      m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Atlas ||
      m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::None)
    return EZ_SUCCESS;

  {
    ezInt32 value = -1;
    EZ_SUCCEED_OR_RETURN(ParseStringOption("-addressU", m_AllowedWrapModes, value));
    m_Processor.m_Descriptor.m_AddressModeU = static_cast<ezImageAddressMode::Enum>(value);
  }
  {
    ezInt32 value = -1;
    EZ_SUCCEED_OR_RETURN(ParseStringOption("-addressV", m_AllowedWrapModes, value));
    m_Processor.m_Descriptor.m_AddressModeV = static_cast<ezImageAddressMode::Enum>(value);
  }

  if (m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Volume)
  {
    ezInt32 value = -1;
    EZ_SUCCEED_OR_RETURN(ParseStringOption("-addressW", m_AllowedWrapModes, value));
    m_Processor.m_Descriptor.m_AddressModeW = static_cast<ezImageAddressMode::Enum>(value);
  }

  return EZ_SUCCESS;
}
void cRawParser::ParseCID(cXmlNode& node) {
    USE_PREFIX(node);
    cCarriedItem cid;
    cid.name = ParseString(node, wxT(RAWXML_CID), wxT("name"), NULL, useprefix).ToAscii();
    cid.nametxt = ParseString(node, wxT(RAWXML_CID), wxT("nametxt"), NULL, useprefix).ToAscii();
    cid.pluralnametxt = ParseString(node, wxT(RAWXML_CID), wxT("pluralnametxt"), NULL, useprefix).ToAscii();
    wxLogVerbose(wxString::Format(_("Adding cid %s to %s."), wxString(cid.name.c_str(), wxConvLocal).c_str(), m_output.GetFullPath().c_str()));

    cXmlNode child(node.children());
    while (child) {
        DO_CONDITION_COMMENT(child);

        if (child(RAWXML_CID_SHAPE)) {
            USE_PREFIX(child);
            cid.shape.shaped = ParseUnsigned(child, wxT(RAWXML_CID_SHAPE), wxT("shaped"));
            if (cid.shape.shaped) {
                cid.shape.shape1 = ParseString(child, wxT(RAWXML_CID_SHAPE), wxT("shape1"), NULL, useprefix).ToAscii();
                cid.shape.shape2 = ParseString(child, wxT(RAWXML_CID_SHAPE), wxT("shape1"), NULL, useprefix).ToAscii();
            } else {
                cid.shape.MakeBillboard();
                cid.shape.fts = ParseString(child, wxT(RAWXML_CID_SHAPE), wxT("ftx"), NULL, useprefix).ToAscii();
            }
            OPTION_PARSE(float, cid.shape.unk9, ParseFloat(child, wxT(RAWXML_CID_SHAPE), wxT("distance")));
            OPTION_PARSE(unsigned long, cid.shape.defaultcolour, ParseUnsigned(child, wxT(RAWXML_CID_SHAPE), wxT("defaultcolour")));
            OPTION_PARSE(float, cid.shape.scalex, ParseFloat(child, wxT(RAWXML_CID_SHAPE), wxT("scalex")));
            OPTION_PARSE(float, cid.shape.scaley, ParseFloat(child, wxT(RAWXML_CID_SHAPE), wxT("scaley")));
        } else if (child(RAWXML_CID_MORE)) {
            USE_PREFIX(child);
            OPTION_PARSE(unsigned long, cid.addonpack, ParseUnsigned(child, wxT(RAWXML_CID_MORE), wxT("addonpack")));
            ParseStringOption(cid.icon, child, wxT("icon"), NULL, useprefix);
        } else if (child(RAWXML_CID_EXTRA)) {
Example #3
0
ezResult ezTexConv2::ParseTargetPlatform()
{
  ezInt32 value = -1;
  EZ_SUCCEED_OR_RETURN(ParseStringOption("-platform", m_AllowedPlatforms, value));

  m_Processor.m_Descriptor.m_TargetPlatform = static_cast<ezTexConvTargetPlatform::Enum>(value);
  return EZ_SUCCESS;
}
Example #4
0
ezResult ezTexConv2::ParseOutputType()
{
  if (m_sOutputFile.IsEmpty())
  {
    m_Processor.m_Descriptor.m_OutputType = ezTexConvOutputType::None;
    return EZ_SUCCESS;
  }

  ezInt32 value = -1;
  EZ_SUCCEED_OR_RETURN(ParseStringOption("-type", m_AllowedOutputTypes, value));

  m_Processor.m_Descriptor.m_OutputType = static_cast<ezTexConvOutputType::Enum>(value);

  if (m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Texture2D)
  {
    if (!m_bOutputSupports2D)
    {
      ezLog::Error("2D textures are not supported by the chosen output file format.");
      return EZ_FAILURE;
    }
  }
  else if (m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Cubemap)
  {
    if (!m_bOutputSupportsCube)
    {
      ezLog::Error("Cubemap textures are not supported by the chosen output file format.");
      return EZ_FAILURE;
    }
  }
  else if (m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Atlas)
  {
    if (!m_bOutputSupportsAtlas)
    {
      ezLog::Error("Atlas textures are not supported by the chosen output file format.");
      return EZ_FAILURE;
    }

    if (!ParseFile("-atlasDesc", m_Processor.m_Descriptor.m_sTextureAtlasDescFile))
      return EZ_FAILURE;
  }
  else if (m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Volume)
  {
    if (!m_bOutputSupports3D)
    {
      ezLog::Error("Volume textures are not supported by the chosen output file format.");
      return EZ_FAILURE;
    }
  }
  else
  {
    EZ_ASSERT_NOT_IMPLEMENTED;
    return EZ_FAILURE;
  }

  return EZ_SUCCESS;
}
Example #5
0
ezResult ezTexConv2::ParseFilterModes()
{
  if (!m_bOutputSupportsFiltering)
    return EZ_SUCCESS;

  ezInt32 value = -1;
  EZ_SUCCEED_OR_RETURN(ParseStringOption("-filter", m_AllowedFilterModes, value));

  m_Processor.m_Descriptor.m_FilterMode = static_cast<ezTextureFilterSetting::Enum>(value);
  return EZ_SUCCESS;
}
Example #6
0
ezResult ezTexConv2::ParseUsage()
{
  if (m_Processor.m_Descriptor.m_OutputType == ezTexConvOutputType::Atlas)
    return EZ_SUCCESS;

  ezInt32 value = -1;
  EZ_SUCCEED_OR_RETURN(ParseStringOption("-usage", m_AllowedUsages, value));

  m_Processor.m_Descriptor.m_Usage = static_cast<ezTexConvUsage::Enum>(value);
  return EZ_SUCCESS;
}
Example #7
0
ezResult ezTexConv2::ParseCompressionMode()
{
  if (!m_bOutputSupportsCompression)
  {
    m_Processor.m_Descriptor.m_CompressionMode = ezTexConvCompressionMode::None;
    return EZ_SUCCESS;
  }

  ezInt32 value = -1;
  EZ_SUCCEED_OR_RETURN(ParseStringOption("-compression", m_AllowedCompressionModes, value));

  m_Processor.m_Descriptor.m_CompressionMode = static_cast<ezTexConvCompressionMode::Enum>(value);
  return EZ_SUCCESS;
}
Example #8
0
void cRawParser::ParseAttraction(const cXmlNode& node, cAttraction& attraction) {
    USE_PREFIX(node);
    OPTION_PARSE(unsigned long, attraction.type, ParseUnsigned(node, wxT(RAWXML_ATTRACTION), wxT("type")));
    OPTION_PARSE(unsigned char, attraction.version, ParseUnsigned(node, wxT(RAWXML_ATTRACTION), wxT("version")));
    ParseStringOption(attraction.icon, node, "icon", NULL, useprefix);
    ParseStringOption(attraction.spline, node, "loopSpline", NULL, useprefix);

    foreach(const cXmlNode& child, node.children()) {
        DO_CONDITION_COMMENT_FOR(child);

        if (child(RAWXML_ATTRACTION_PATH)) {
            USE_PREFIX(child);
            string path = ParseString(child, RAWXML_ATTRACTION_PATH, "spline", NULL, useprefix);
            attraction.splines.push_back(path);
        } else if (child(RAWXML_ATTRACTION_MISC)) {
            OPTION_PARSE(unsigned long, attraction.baseUpkeep, ParseUnsigned(child, wxT(RAWXML_ATTRACTION_MISC), wxT("baseUpkeep")));
            OPTION_PARSE(unsigned long, attraction.unk2, ParseUnsigned(child, wxT(RAWXML_ATTRACTION_MISC), wxT("u2")));
            OPTION_PARSE(unsigned long, attraction.unk3, ParseUnsigned(child, wxT(RAWXML_ATTRACTION_MISC), wxT("u3")));
            OPTION_PARSE(unsigned long, attraction.flags, ParseUnsigned(child, wxT(RAWXML_ATTRACTION_MISC), wxT("flags")));
            OPTION_PARSE(long, attraction.maxHeight, ParseSigned(child, wxT(RAWXML_ATTRACTION_MISC), wxT("maxHeight")));
        } else if (child(RAWXML_ATTRACTION_STATIC_UNK)) {
            OPTION_PARSE(unsigned long, attraction.unk4, ParseUnsigned(child, wxT(RAWXML_ATTRACTION_STATIC_UNK), wxT("u4")));
            OPTION_PARSE(unsigned long, attraction.unk5, ParseUnsigned(child, wxT(RAWXML_ATTRACTION_STATIC_UNK), wxT("u5")));
        } else if (child(RAWXML_ATTRACTION_EXTENSION)) {
Example #9
0
void cRawParser::ParseVariables(cXmlNode& node, bool command, const wxString& path) {
    wxString inc = wxT("");
    ParseStringOption(inc, node, wxT("include"), NULL);
    if (!inc.IsEmpty()) {
        wxFSFileName src;
        if (path.IsEmpty()) {
            src = m_input.GetPath();
        } else {
            src = wxFSFileName(path, true);
        }
        wxFSFileName filename = inc;
        if (!filename.IsAbsolute())
            filename.MakeAbsolute(src.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME));
        LoadVariables(filename, command, (m_bake.Index(wxT(RAWXML_VARIABLES))!=wxNOT_FOUND)?&node:NULL );

        if (m_mode == MODE_BAKE) {
            if (m_bake.Index(wxT(RAWXML_VARIABLES)) == wxNOT_FOUND) {
                wxString newfile;
                if (m_bake.Index(wxT(RAWBAKE_ABSOLUTE)) == wxNOT_FOUND) {
                    filename.MakeRelativeTo(m_bakeroot.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME));
                }
                newfile = filename.GetFullPath();
                node.delProp("include");
                node.addProp("include", newfile.utf8_str());
            } else {
                node.delProp("include");
            }
        }
    }

    cXmlNode child(node.children());
    while (child) {
        DO_CONDITION_COMMENT(child);

        if (child(RAWXML_SET)) {
            ParseSet(child, command);
        } else if (child(RAWXML_UNSET)) {
            ParseUnset(child, command);
        } else if (child(RAWXML_VARIABLES)) {
            ParseVariables(child, command, path);
        } else if (child.is(XML_ELEMENT_NODE)) {
            throw MakeNodeException<RCT3Exception>(wxString::Format(_("Unknown tag '%s' in variables tag"), child.wxname().c_str()), child);
        }
        child.go_next();
    }
}
Example #10
0
ezResult ezTexConv2::ParseMipmapMode()
{
  if (!m_bOutputSupportsMipmaps)
  {
    m_Processor.m_Descriptor.m_MipmapMode = ezTexConvMipmapMode::None;
    return EZ_SUCCESS;
  }

  ezInt32 value = -1;
  EZ_SUCCEED_OR_RETURN(ParseStringOption("-mipmaps", m_AllowedMimapModes, value));
  m_Processor.m_Descriptor.m_MipmapMode = static_cast<ezTexConvMipmapMode::Enum>(value);


  EZ_SUCCEED_OR_RETURN(ParseBoolOption("-mipsPerserveCoverage", m_Processor.m_Descriptor.m_bPreserveMipmapCoverage));

  if (m_Processor.m_Descriptor.m_bPreserveMipmapCoverage)
  {
    EZ_SUCCEED_OR_RETURN(ParseFloatOption("-mipsAlphaThreshold", 0.01f, 0.99f, m_Processor.m_Descriptor.m_fMipmapAlphaThreshold));
  }

  return EZ_SUCCESS;
}