Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

4.3 KB
Raw Blame
import vhtml from 'vhtml';
import { ValidatorTable } from './validator-table';

/** @jsx vhtml */

export function ValidatorReport({
	info,
	validatorVersion,
	issues,
	errors,
	warnings,
	hints,
	infos,
	reportJSON,
}) {
	const totalIssues = issues.numErrors + issues.numWarnings + issues.numInfos + issues.numHints;
	const isClean = totalIssues === 0;
	return (
		<div class="report">
			<div class="report-head">
				{/* h2, not h1: this report renders inside pages that already own one. */}
				<h2>Validation report</h2>
				{reportJSON && (
					<a
						class="report-download"
						href={reportJSON}
						download="gltf-validation-report.json"
					>
						Download JSON
					</a>
				)}
			</div>
			{isClean ? (
				<div class="report-banner report-banner-clean" role="status">
					<span class="report-banner-icon" aria-hidden="true">
						✓
					</span>
					<span>All clear: no validation issues found.</span>
				</div>
			) : (
				<div class="report-banner report-banner-issues" role="status">
					<span>
						Found <b>{totalIssues}</b> issue{totalIssues === 1 ? '' : 's'}:{' '}
						{issues.numErrors > 0 && (
							<span>
								<b>{issues.numErrors}</b> error{issues.numErrors === 1 ? '' : 's'}
							</span>
						)}
						{issues.numErrors > 0 && issues.numWarnings > 0 && ', '}
						{issues.numWarnings > 0 && (
							<span>
								<b>{issues.numWarnings}</b> warning
								{issues.numWarnings === 1 ? '' : 's'}
							</span>
						)}
						{(issues.numErrors > 0 || issues.numWarnings > 0) &&
							(issues.numInfos > 0 || issues.numHints > 0) &&
							', '}
						{issues.numInfos > 0 && (
							<span>
								<b>{issues.numInfos}</b> info
							</span>
						)}
						{issues.numInfos > 0 && issues.numHints > 0 && ', '}
						{issues.numHints > 0 && (
							<span>
								<b>{issues.numHints}</b> hint{issues.numHints === 1 ? '' : 's'}
							</span>
						)}
						.
					</span>
				</div>
			)}
			<ul>
				<li>
					<b>Format:</b> glTF {info.version}
				</li>
				<li>
					<b>Generator:</b> {info.generator}
				</li>
				{info?.extras?.title && (
					<li>
						<b>Title:</b> <span>{info.extras.title}</span>
					</li>
				)}
				{info?.extras?.author && (
					<li>
						<b>Author:</b> <span>{info.extras.author}</span>
					</li>
				)}
				{info?.extras?.license && (
					<li>
						<b>License:</b> <span>{info.extras.license}</span>
					</li>
				)}
				{info?.extras?.source && (
					<li>
						<b>Source:</b> <span>{info.extras.source}</span>
					</li>
				)}
				<li>
					<b>Stats:</b>
					<ul>
						<li>{info.drawCallCount || '0'} draw calls</li>
						<li>{info.animationCount || '0'} animations</li>
						<li>{info.materialCount || '0'} materials</li>
						<li>{info.totalVertexCount || '0'} vertices</li>
						<li>{info.totalTriangleCount || '0'} triangles</li>
					</ul>
				</li>
				<li>
					<b>Extensions:</b>
					<ul>
						{info.extensionsUsed?.length ? (
							info.extensionsUsed.map((extension) => <li>{extension}</li>)
						) : (
							<li>None</li>
						)}
					</ul>
					{info.extensionsUsed?.length > 0 && (
						<p>
							<i>
								NOTE: Extensions above are present in the model, but may or may not
								be recognized by this viewer. Any "UNSUPPORTED_EXTENSION" warnings
								below refer only to extensions that could not be scanned by the
								validation suite, and may still have rendered correctly. The
								ratified and vendor extensions are listed in the{' '}
								<a
									href="https://github.com/KhronosGroup/glTF/tree/main/extensions"
									target="_blank"
									rel="noreferrer"
								>
									Khronos extension registry
								</a>
								.
							</i>
						</p>
					)}
				</li>
			</ul>
			<hr />
			<p>
				Report generated by{' '}
				<a
					href="https://github.com/KhronosGroup/glTF-Validator/"
					target="_blank"
					rel="noreferrer"
				>
					KhronosGroup/glTF-Validator
				</a>{' '}
				{validatorVersion}.
			</p>
			{issues.numErrors > 0 && (
				<ValidatorTable messages={errors} color="#f44336" title="Error" />
			)}
			{issues.numWarnings > 0 && (
				<ValidatorTable messages={warnings} color="#f9a825" title="Warning" />
			)}
			{issues.numHints > 0 && (
				<ValidatorTable messages={hints} color="#8bc34a" title="Hint" />
			)}
			{issues.numInfos > 0 && (
				<ValidatorTable messages={infos} color="#2196f3" title="Info" />
			)}
		</div>
	);
}