| 1787 | } |
| 1788 | |
| 1789 | void GLSLCompiler::translateStructure(glsl::astStruct *structure) { |
| 1790 | m_structures.push_back(Structure()); |
| 1791 | Structure& str = m_structures[m_structures.size()-1]; |
| 1792 | |
| 1793 | if (structure->name) { |
| 1794 | str.Name = structure->name; |
| 1795 | str.ID = m_gen.AddObject(structure->name); |
| 1796 | } |
| 1797 | for (size_t i = 0; i < structure->fields.size(); i++) { |
| 1798 | glsl::astVariable* prop = structure->fields[i]; |
| 1799 | Variable propData; |
| 1800 | |
| 1801 | propData.Name = prop->name; |
| 1802 | m_gen.AddProperty(str.Name, prop->name); |
| 1803 | |
| 1804 | if (prop->baseType->builtin) |
| 1805 | propData.Type = kTypes[((glsl::astBuiltin*)prop->baseType)->type]; |
| 1806 | else |
| 1807 | propData.Type = ((glsl::astStruct*)prop->baseType)->name; |
| 1808 | |
| 1809 | str.Members.push_back(propData); |
| 1810 | |
| 1811 | // TODO: array members |
| 1812 | // if (variable->isArray) |
| 1813 | // printArraySize(variable->arraySizes); |
| 1814 | } |
| 1815 | } |
| 1816 | |
| 1817 | void GLSLCompiler::translate(glsl::astTU *tu) { |
| 1818 | for (size_t i = 0; i < tu->structures.size(); i++) |